Skip to content

Commit

Permalink
remove once_cell in place of standard libraries LazyLock
Browse files Browse the repository at this point in the history
  • Loading branch information
genusistimelord committed Sep 19, 2024
1 parent b83e166 commit 59e89dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ authors = [
edition = "2021"
description = "Additional widgets for the Iced GUI library"
license = "MIT"
homepage = "https://iced.rs"
repository = "https://github.com/iced-rs/iced_aw"
# TODO documentation
readme = "README.md"
keywords = ["gui", "graphics", "interface", "widgets", "iced"]
categories = ["gui"]
rust-version = "1.80"

[features]
badge = []
card = []
date_picker = ["chrono", "once_cell", "icons"]
date_picker = ["chrono", "icons"]
color_picker = ["icons", "iced/canvas"]
cupertino = ["time", "iced/canvas", "icons"]
grid = ["itertools"]
Expand Down Expand Up @@ -65,13 +66,12 @@ chrono = { version = "0.4.38", optional = true }
itertools = { version = "0.13.0", optional = true }
num-format = { version = "0.4.4", optional = true }
num-traits = { version = "0.2.19", optional = true }
once_cell = { version = "1.19.0", optional = true }
time = { version = "0.3.36", features = ["local-offset"], optional = true }

[dependencies.iced]
#git = "https://github.com/iced-rs/iced.git"
#rev = "b474a2b7a763dcde6a377cb409001a7b5285ee8d"
version = "0.13.0"
version = "0.13.1"
default-features = false
features = ["advanced"]

Expand Down
6 changes: 3 additions & 3 deletions src/core/date.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Helper functions for calculating dates
use chrono::{Datelike, Duration, Local, NaiveDate};
use once_cell::sync::Lazy;
use std::fmt::Display;
use std::sync::LazyLock;

/// The date value
#[derive(Clone, Copy, Debug)]
Expand Down Expand Up @@ -221,7 +221,7 @@ pub fn date_as_string(date: NaiveDate) -> String {
}

/// Gets the length of the longest month name.
pub static MAX_MONTH_STR_LEN: Lazy<usize> = Lazy::new(|| {
pub static MAX_MONTH_STR_LEN: LazyLock<usize> = LazyLock::new(|| {
let months = [
NaiveDate::from_ymd_opt(0, 1, 1).expect("Year, Month or Day doesnt Exist"),
NaiveDate::from_ymd_opt(0, 2, 1).expect("Year, Month or Day doesnt Exist"),
Expand Down Expand Up @@ -252,7 +252,7 @@ pub static MAX_MONTH_STR_LEN: Lazy<usize> = Lazy::new(|| {

/// Gets the labels of the weekdays containing the first two characters of
/// the weekdays.
pub static WEEKDAY_LABELS: Lazy<Vec<String>> = Lazy::new(|| {
pub static WEEKDAY_LABELS: LazyLock<Vec<String>> = LazyLock::new(|| {
let days = [
// Monday
NaiveDate::from_ymd_opt(2020, 6, 1).expect("Year, Month or Day doesnt Exist"),
Expand Down

0 comments on commit 59e89dd

Please sign in to comment.