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`).
This commit is contained in:
parent
82217947aa
commit
be9cd3a09f
6 changed files with 13 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use iced_core::Color;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::Lazy;
|
||||
use palette::{FromColor, Hsl, Mix, RelativeContrast, Srgb};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
|
|
@ -66,11 +66,10 @@ pub struct Extended {
|
|||
pub danger: Danger,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref EXTENDED_LIGHT: Extended =
|
||||
Extended::generate(Palette::LIGHT);
|
||||
pub static ref EXTENDED_DARK: Extended = Extended::generate(Palette::DARK);
|
||||
}
|
||||
pub static EXTENDED_LIGHT: Lazy<Extended> =
|
||||
Lazy::new(|| Extended::generate(Palette::LIGHT));
|
||||
pub static EXTENDED_DARK: Lazy<Extended> =
|
||||
Lazy::new(|| Extended::generate(Palette::DARK));
|
||||
|
||||
impl Extended {
|
||||
pub fn generate(palette: Palette) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue