Skip to content

Commit 12c3bc0

Browse files
author
genusistimelord
committed
update and change dependencies before Pushing release.
1 parent e25046e commit 12c3bc0

File tree

5 files changed

+61
-62
lines changed

5 files changed

+61
-62
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Breaking Selection list Message Type is now Name((usize, T)) for on_select.
1919
- Upgraded to Latest Iced 0.10.0.
2020
- Depreciating Older Versions of Iced_aw.
21+
- Switched lazy_static to OnceCell
2122

2223
### Fixed
2324
- Floating Element Position is corrected. Original position issue was due to Center_x containg both X and Width/2.

Cargo.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ categories = ["gui"]
1414
[features]
1515
badge = []
1616
card = []
17-
date_picker = ["chrono", "lazy_static", "icon_text"]
17+
date_picker = ["chrono", "once_cell", "icon_text"]
1818
color_picker = ["icon_text", "iced_widget/canvas"]
1919
cupertino = ["iced_widget/canvas", "time"]
2020
floating_element = []
@@ -59,11 +59,10 @@ default = [
5959
]
6060

6161
[dependencies]
62-
num-traits = { version = "0.2.15", optional = true }
63-
time = { version = "0.3.5", features = ["local-offset"], optional = true }
64-
chrono = { version = "0.4.23", optional = true }
65-
lazy_static = { version = "1.4.0", optional = true }
66-
62+
num-traits = { version = "0.2.16", optional = true }
63+
time = { version = "0.3.23", features = ["local-offset"], optional = true }
64+
chrono = { version = "0.4.26", optional = true }
65+
once_cell = { version = "1.18.0", optional = true }
6766

6867

6968
[dependencies.iced_widget]

src/core/date.rs

+53-54
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use chrono::Local;
66

77
use chrono::{Datelike, Duration, NaiveDate};
88

9-
use lazy_static::lazy_static;
9+
use once_cell::sync::Lazy;
1010

1111
/// The date value
1212
#[derive(Clone, Copy, Debug, Default)]
@@ -222,59 +222,58 @@ pub fn month_as_string(date: NaiveDate) -> String {
222222
date.format("%B").to_string()
223223
}
224224

225-
lazy_static! {
226-
/// Gets the length of the longest month name.
227-
pub static ref MAX_MONTH_STR_LEN: usize = {
228-
let months = [
229-
NaiveDate::from_ymd_opt(0, 1, 1).expect("Year, Month or Day doesnt Exist"),
230-
NaiveDate::from_ymd_opt(0, 2, 1).expect("Year, Month or Day doesnt Exist"),
231-
NaiveDate::from_ymd_opt(0, 3, 1).expect("Year, Month or Day doesnt Exist"),
232-
NaiveDate::from_ymd_opt(0, 4, 1).expect("Year, Month or Day doesnt Exist"),
233-
NaiveDate::from_ymd_opt(0, 5, 1).expect("Year, Month or Day doesnt Exist"),
234-
NaiveDate::from_ymd_opt(0, 6, 1).expect("Year, Month or Day doesnt Exist"),
235-
NaiveDate::from_ymd_opt(0, 7, 1).expect("Year, Month or Day doesnt Exist"),
236-
NaiveDate::from_ymd_opt(0, 8, 1).expect("Year, Month or Day doesnt Exist"),
237-
NaiveDate::from_ymd_opt(0, 9, 1).expect("Year, Month or Day doesnt Exist"),
238-
NaiveDate::from_ymd_opt(0, 10, 1).expect("Year, Month or Day doesnt Exist"),
239-
NaiveDate::from_ymd_opt(0, 11, 1).expect("Year, Month or Day doesnt Exist"),
240-
NaiveDate::from_ymd_opt(0, 12, 1).expect("Year, Month or Day doesnt Exist"),
241-
];
242-
243-
let max = months.iter()
244-
.map(|m| month_as_string(*m))
245-
.map(|s| s.len())
246-
.max().expect("There should be a maximum element");
247-
248-
max
249-
};
250-
251-
/// Gets the labels of the weekdays containing the first two characters of
252-
/// the weekdays.
253-
pub static ref WEEKDAY_LABELS: Vec<String> = {
254-
let days = [
255-
// Monday
256-
NaiveDate::from_ymd_opt(2020, 6, 1).expect("Year, Month or Day doesnt Exist"),
257-
// Tuesday
258-
NaiveDate::from_ymd_opt(2020, 6, 2).expect("Year, Month or Day doesnt Exist"),
259-
// Wednesday
260-
NaiveDate::from_ymd_opt(2020, 6, 3).expect("Year, Month or Day doesnt Exist"),
261-
// Thursday
262-
NaiveDate::from_ymd_opt(2020, 6, 4).expect("Year, Month or Day doesnt Exist"),
263-
// Friday
264-
NaiveDate::from_ymd_opt(2020, 6, 5).expect("Year, Month or Day doesnt Exist"),
265-
// Saturday
266-
NaiveDate::from_ymd_opt(2020, 6, 6).expect("Year, Month or Day doesnt Exist"),
267-
// Sunday
268-
NaiveDate::from_ymd_opt(2020, 6, 7).expect("Year, Month or Day doesnt Exist"),
269-
270-
];
271-
272-
days.iter()
273-
.map(|d| d.format("%a").to_string())
274-
.map(|s| s[0..2].to_owned())
275-
.collect()
276-
};
277-
}
225+
/// Gets the length of the longest month name.
226+
pub static MAX_MONTH_STR_LEN: Lazy<usize> = Lazy::new(|| {
227+
let months = [
228+
NaiveDate::from_ymd_opt(0, 1, 1).expect("Year, Month or Day doesnt Exist"),
229+
NaiveDate::from_ymd_opt(0, 2, 1).expect("Year, Month or Day doesnt Exist"),
230+
NaiveDate::from_ymd_opt(0, 3, 1).expect("Year, Month or Day doesnt Exist"),
231+
NaiveDate::from_ymd_opt(0, 4, 1).expect("Year, Month or Day doesnt Exist"),
232+
NaiveDate::from_ymd_opt(0, 5, 1).expect("Year, Month or Day doesnt Exist"),
233+
NaiveDate::from_ymd_opt(0, 6, 1).expect("Year, Month or Day doesnt Exist"),
234+
NaiveDate::from_ymd_opt(0, 7, 1).expect("Year, Month or Day doesnt Exist"),
235+
NaiveDate::from_ymd_opt(0, 8, 1).expect("Year, Month or Day doesnt Exist"),
236+
NaiveDate::from_ymd_opt(0, 9, 1).expect("Year, Month or Day doesnt Exist"),
237+
NaiveDate::from_ymd_opt(0, 10, 1).expect("Year, Month or Day doesnt Exist"),
238+
NaiveDate::from_ymd_opt(0, 11, 1).expect("Year, Month or Day doesnt Exist"),
239+
NaiveDate::from_ymd_opt(0, 12, 1).expect("Year, Month or Day doesnt Exist"),
240+
];
241+
242+
let max = months
243+
.iter()
244+
.map(|m| month_as_string(*m))
245+
.map(|s| s.len())
246+
.max()
247+
.expect("There should be a maximum element");
248+
249+
max
250+
});
251+
252+
/// Gets the labels of the weekdays containing the first two characters of
253+
/// the weekdays.
254+
pub static WEEKDAY_LABELS: Lazy<Vec<String>> = Lazy::new(|| {
255+
let days = [
256+
// Monday
257+
NaiveDate::from_ymd_opt(2020, 6, 1).expect("Year, Month or Day doesnt Exist"),
258+
// Tuesday
259+
NaiveDate::from_ymd_opt(2020, 6, 2).expect("Year, Month or Day doesnt Exist"),
260+
// Wednesday
261+
NaiveDate::from_ymd_opt(2020, 6, 3).expect("Year, Month or Day doesnt Exist"),
262+
// Thursday
263+
NaiveDate::from_ymd_opt(2020, 6, 4).expect("Year, Month or Day doesnt Exist"),
264+
// Friday
265+
NaiveDate::from_ymd_opt(2020, 6, 5).expect("Year, Month or Day doesnt Exist"),
266+
// Saturday
267+
NaiveDate::from_ymd_opt(2020, 6, 6).expect("Year, Month or Day doesnt Exist"),
268+
// Sunday
269+
NaiveDate::from_ymd_opt(2020, 6, 7).expect("Year, Month or Day doesnt Exist"),
270+
];
271+
272+
days.iter()
273+
.map(|d| d.format("%a").to_string())
274+
.map(|s| s[0..2].to_owned())
275+
.collect()
276+
});
278277

279278
#[cfg(test)]
280279

src/native/menu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//!
55
//! # Example
66
//!
7-
//! ```
7+
//! ```ignore
88
//! use iced::widget::button;
99
//! use iced_aw::menu::{MenuTree, MenuBar};
1010
//!

src/native/time_picker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub use crate::style::time_picker::{Appearance, StyleSheet};
2828
///
2929
/// # Example
3030
/// ```ignore
31-
/// # use iced_aw::{TimePicker,time_picker};
31+
/// # use iced_aw::{TimePicker, time_picker};
3232
/// # use iced_native::widget::{button, Button, Text};
3333
/// #
3434
/// #[derive(Clone, Debug)]

0 commit comments

Comments
 (0)