From be9cd3a09f4fb027786c634158ddeaca75a169f0 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 28 Oct 2022 14:43:18 -0700 Subject: 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`). --- examples/websocket/Cargo.toml | 2 +- examples/websocket/src/main.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'examples/websocket') diff --git a/examples/websocket/Cargo.toml b/examples/websocket/Cargo.toml index 3981f699..fcb4dd3f 100644 --- a/examples/websocket/Cargo.toml +++ b/examples/websocket/Cargo.toml @@ -9,7 +9,7 @@ publish = false iced = { path = "../..", features = ["tokio", "debug"] } iced_native = { path = "../../native" } iced_futures = { path = "../../futures" } -lazy_static = "1.4" +once_cell = "1.15.0" [dependencies.async-tungstenite] version = "0.16" diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index 3902e04c..ff2929da 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -8,6 +8,7 @@ use iced::widget::{ use iced::{ Application, Color, Command, Element, Length, Settings, Subscription, Theme, }; +use once_cell::sync::Lazy; pub fn main() -> iced::Result { WebSocket::run(Settings::default()) @@ -165,6 +166,4 @@ impl Default for State { } } -lazy_static::lazy_static! { - static ref MESSAGE_LOG: scrollable::Id = scrollable::Id::unique(); -} +static MESSAGE_LOG: Lazy = Lazy::new(scrollable::Id::unique); -- cgit From 743a7192b70bc5184aa47e7851098b75b8a1f288 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 1 Nov 2022 19:55:37 +0100 Subject: Remove patch version from `once_cell` dependency --- examples/websocket/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/websocket') diff --git a/examples/websocket/Cargo.toml b/examples/websocket/Cargo.toml index fcb4dd3f..c25f067b 100644 --- a/examples/websocket/Cargo.toml +++ b/examples/websocket/Cargo.toml @@ -9,7 +9,7 @@ publish = false iced = { path = "../..", features = ["tokio", "debug"] } iced_native = { path = "../../native" } iced_futures = { path = "../../futures" } -once_cell = "1.15.0" +once_cell = "1.15" [dependencies.async-tungstenite] version = "0.16" -- cgit