summaryrefslogtreecommitdiffstats
path: root/examples/todos
diff options
context:
space:
mode:
authorLibravatar Ian Douglas Scott <idscott@system76.com>2022-10-28 14:43:18 -0700
committerLibravatar Ian Douglas Scott <idscott@system76.com>2022-10-28 15:58:21 -0700
commitbe9cd3a09f4fb027786c634158ddeaca75a169f0 (patch)
tree3685a32b728bf6cfe426f46c437574f62a3d53db /examples/todos
parent82217947aa80287282ed6deb02d238a31303e0d6 (diff)
downloadiced-be9cd3a09f4fb027786c634158ddeaca75a169f0.tar.gz
iced-be9cd3a09f4fb027786c634158ddeaca75a169f0.tar.bz2
iced-be9cd3a09f4fb027786c634158ddeaca75a169f0.zip
Use `once_cell` instead of `lazy_static`
This seems to be generally considered the preferred, idiomatic solution now. This is in the standard library behind a feature flag (apparently now called `std::sync::LazyLock`).
Diffstat (limited to 'examples/todos')
-rw-r--r--examples/todos/Cargo.toml2
-rw-r--r--examples/todos/src/main.rs6
2 files changed, 3 insertions, 5 deletions
diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml
index 2326ffc6..d9916057 100644
--- a/examples/todos/Cargo.toml
+++ b/examples/todos/Cargo.toml
@@ -7,9 +7,9 @@ publish = false
[dependencies]
iced = { path = "../..", features = ["async-std", "debug"] }
+once_cell = "1.15.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
-lazy_static = "1.4"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
async-std = "1.0"
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index bddc0e71..be48ae8c 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -11,12 +11,10 @@ use iced::window;
use iced::{Application, Element};
use iced::{Color, Command, Font, Length, Settings, Subscription};
-use lazy_static::lazy_static;
+use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
-lazy_static! {
- static ref INPUT_ID: text_input::Id = text_input::Id::unique();
-}
+static INPUT_ID: Lazy<text_input::Id> = Lazy::new(text_input::Id::unique);
pub fn main() -> iced::Result {
Todos::run(Settings {