From 0e8c3fe30fd7c9a9ff54d2f6d75324575df5511a Mon Sep 17 00:00:00 2001 From: Tommy Volk Date: Thu, 3 Oct 2024 22:27:25 -0500 Subject: chore: remove once_cell dependency --- examples/loading_spinners/Cargo.toml | 1 - examples/loading_spinners/src/easing.rs | 15 ++++++++------- examples/scrollable/Cargo.toml | 2 -- examples/scrollable/src/main.rs | 7 ++++--- examples/visible_bounds/Cargo.toml | 2 -- examples/visible_bounds/src/main.rs | 10 +++++----- examples/websocket/Cargo.toml | 1 - examples/websocket/src/main.rs | 6 ++++-- 8 files changed, 21 insertions(+), 23 deletions(-) (limited to 'examples') diff --git a/examples/loading_spinners/Cargo.toml b/examples/loading_spinners/Cargo.toml index a32da386..abd28aec 100644 --- a/examples/loading_spinners/Cargo.toml +++ b/examples/loading_spinners/Cargo.toml @@ -10,4 +10,3 @@ iced.workspace = true iced.features = ["advanced", "canvas"] lyon_algorithms = "1.0" -once_cell.workspace = true \ No newline at end of file diff --git a/examples/loading_spinners/src/easing.rs b/examples/loading_spinners/src/easing.rs index 45089ef6..be644d31 100644 --- a/examples/loading_spinners/src/easing.rs +++ b/examples/loading_spinners/src/easing.rs @@ -1,41 +1,42 @@ +use std::sync::LazyLock; + use iced::Point; use lyon_algorithms::measure::PathMeasurements; use lyon_algorithms::path::{builder::NoAttributes, path::BuilderImpl, Path}; -use once_cell::sync::Lazy; -pub static EMPHASIZED: Lazy = Lazy::new(|| { +pub static EMPHASIZED: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.05, 0.0], [0.133333, 0.06], [0.166666, 0.4]) .cubic_bezier_to([0.208333, 0.82], [0.25, 1.0], [1.0, 1.0]) .build() }); -pub static EMPHASIZED_DECELERATE: Lazy = Lazy::new(|| { +pub static EMPHASIZED_DECELERATE: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.05, 0.7], [0.1, 1.0], [1.0, 1.0]) .build() }); -pub static EMPHASIZED_ACCELERATE: Lazy = Lazy::new(|| { +pub static EMPHASIZED_ACCELERATE: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.3, 0.0], [0.8, 0.15], [1.0, 1.0]) .build() }); -pub static STANDARD: Lazy = Lazy::new(|| { +pub static STANDARD: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.2, 0.0], [0.0, 1.0], [1.0, 1.0]) .build() }); -pub static STANDARD_DECELERATE: Lazy = Lazy::new(|| { +pub static STANDARD_DECELERATE: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.0, 0.0], [0.0, 1.0], [1.0, 1.0]) .build() }); -pub static STANDARD_ACCELERATE: Lazy = Lazy::new(|| { +pub static STANDARD_ACCELERATE: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.3, 0.0], [1.0, 1.0], [1.0, 1.0]) .build() diff --git a/examples/scrollable/Cargo.toml b/examples/scrollable/Cargo.toml index f8c735c0..ba291520 100644 --- a/examples/scrollable/Cargo.toml +++ b/examples/scrollable/Cargo.toml @@ -8,5 +8,3 @@ publish = false [dependencies] iced.workspace = true iced.features = ["debug"] - -once_cell.workspace = true diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index de4f2f9a..bd12e43b 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -1,12 +1,13 @@ +use std::sync::LazyLock; + use iced::widget::{ button, column, container, horizontal_space, progress_bar, radio, row, scrollable, slider, text, vertical_space, }; use iced::{Border, Center, Color, Element, Fill, Task, Theme}; -use once_cell::sync::Lazy; - -static SCROLLABLE_ID: Lazy = Lazy::new(scrollable::Id::unique); +static SCROLLABLE_ID: LazyLock = + LazyLock::new(scrollable::Id::unique); pub fn main() -> iced::Result { iced::application( diff --git a/examples/visible_bounds/Cargo.toml b/examples/visible_bounds/Cargo.toml index 37594b84..1193334d 100644 --- a/examples/visible_bounds/Cargo.toml +++ b/examples/visible_bounds/Cargo.toml @@ -8,5 +8,3 @@ publish = false [dependencies] iced.workspace = true iced.features = ["debug"] - -once_cell.workspace = true diff --git a/examples/visible_bounds/src/main.rs b/examples/visible_bounds/src/main.rs index 77fec65e..f8f9f420 100644 --- a/examples/visible_bounds/src/main.rs +++ b/examples/visible_bounds/src/main.rs @@ -157,9 +157,9 @@ impl Example { } } -use once_cell::sync::Lazy; +use std::sync::LazyLock; -static OUTER_CONTAINER: Lazy = - Lazy::new(|| container::Id::new("outer")); -static INNER_CONTAINER: Lazy = - Lazy::new(|| container::Id::new("inner")); +static OUTER_CONTAINER: LazyLock = + LazyLock::new(|| container::Id::new("outer")); +static INNER_CONTAINER: LazyLock = + LazyLock::new(|| container::Id::new("inner")); diff --git a/examples/websocket/Cargo.toml b/examples/websocket/Cargo.toml index c7075fb3..787dbbe1 100644 --- a/examples/websocket/Cargo.toml +++ b/examples/websocket/Cargo.toml @@ -9,7 +9,6 @@ publish = false iced.workspace = true iced.features = ["debug", "tokio"] -once_cell.workspace = true warp = "0.3" [dependencies.async-tungstenite] diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index 8b1efb41..399ce2ff 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -1,10 +1,11 @@ mod echo; +use std::sync::LazyLock; + use iced::widget::{ self, button, center, column, row, scrollable, text, text_input, }; use iced::{color, Center, Element, Fill, Subscription, Task}; -use once_cell::sync::Lazy; pub fn main() -> iced::Result { iced::application("WebSocket - Iced", WebSocket::update, WebSocket::view) @@ -138,4 +139,5 @@ enum State { Connected(echo::Connection), } -static MESSAGE_LOG: Lazy = Lazy::new(scrollable::Id::unique); +static MESSAGE_LOG: LazyLock = + LazyLock::new(scrollable::Id::unique); -- cgit From 2b8b3fd413b03d6b79f1de90bd42eb43c5cd6aa0 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 6 Jan 2025 23:00:21 +0100 Subject: Fix consistency of import ordering --- examples/loading_spinners/src/easing.rs | 4 ++-- examples/scrollable/src/main.rs | 4 ++-- examples/websocket/src/main.rs | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/loading_spinners/src/easing.rs b/examples/loading_spinners/src/easing.rs index be644d31..8caf282d 100644 --- a/examples/loading_spinners/src/easing.rs +++ b/examples/loading_spinners/src/easing.rs @@ -1,10 +1,10 @@ -use std::sync::LazyLock; - use iced::Point; use lyon_algorithms::measure::PathMeasurements; use lyon_algorithms::path::{builder::NoAttributes, path::BuilderImpl, Path}; +use std::sync::LazyLock; + pub static EMPHASIZED: LazyLock = LazyLock::new(|| { Easing::builder() .cubic_bezier_to([0.05, 0.0], [0.133333, 0.06], [0.166666, 0.4]) diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index bd12e43b..6359fb5a 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -1,11 +1,11 @@ -use std::sync::LazyLock; - use iced::widget::{ button, column, container, horizontal_space, progress_bar, radio, row, scrollable, slider, text, vertical_space, }; use iced::{Border, Center, Color, Element, Fill, Task, Theme}; +use std::sync::LazyLock; + static SCROLLABLE_ID: LazyLock = LazyLock::new(scrollable::Id::unique); diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index 399ce2ff..ae658471 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -1,11 +1,10 @@ mod echo; -use std::sync::LazyLock; - use iced::widget::{ self, button, center, column, row, scrollable, text, text_input, }; use iced::{color, Center, Element, Fill, Subscription, Task}; +use std::sync::LazyLock; pub fn main() -> iced::Result { iced::application("WebSocket - Iced", WebSocket::update, WebSocket::view) -- cgit