pub struct Date {
pub year: i32,
pub month: u8,
pub day: u8,
}Expand description
A proleptic Gregorian calendar date.
Fields§
§year: i32§month: u8§day: u8Implementations§
Source§impl Date
impl Date
Sourcepub fn new(year: i32, month: u8, day: u8) -> Option<Self>
pub fn new(year: i32, month: u8, day: u8) -> Option<Self>
Creates a date when the year/month/day combination is valid.
Examples found in repository?
examples/showcase/app.rs (line 221)
203 fn default() -> Self {
204 Self {
205 navigation: navigation::NavigationState::new(ShowcasePage::Inputs),
206 window_size: Size::new(1080.0, 980.0),
207 count: 0,
208 note: String::new(),
209 editor_content: material::widget::text_editor::Content::with_text(
210 "Material 3 multi-line text editor",
211 ),
212 select_choice: Some("Assist"),
213 combobox_options: material::widget::combobox::State::with_selection(
214 vec!["Assist", "Suggestion", "Filter"],
215 Some(&"Suggestion"),
216 ),
217 combobox_choice: Some("Suggestion"),
218 combobox_input: String::new(),
219 search_query: String::new(),
220 date_picker: material::widget::picker::DatePickerState::new(
221 material::widget::picker::Date::new(2026, 7, 4),
222 ),
223 date_range_picker: material::widget::picker::DateRangePickerState::new(
224 material::widget::picker::Date::new(2026, 7, 4),
225 material::widget::picker::Date::new(2026, 7, 10),
226 ),
227 time_picker: material::widget::picker::TimePickerState::new(14, 30, false),
228 progress: 42.0,
229 enabled: true,
230 radio_choice: Some(RadioChoice::Standard),
231 segment_choice: SegmentChoice::List,
232 segment_state: material::widget::segmented_button::State::new(
233 SegmentChoice::List.index(),
234 ),
235 primary_tab: TabChoice::Inputs,
236 primary_tab_state: material::widget::tabs::State::new(TabChoice::Inputs.index()),
237 secondary_tab: TabChoice::Controls,
238 secondary_tab_state: material::widget::tabs::State::new(TabChoice::Controls.index()),
239 log_viewer: material::widget::log_viewer::State::new(),
240 log_entries: sample_log_entries(),
241 progress_animation: material::widget::progress_bar::IndeterminateState::new(
242 Instant::now(),
243 ),
244 login_dialog: material::widget::dialog::Transition::default(),
245 dialog_account: String::new(),
246 dialog_password: String::new(),
247 dialog_remember_password: false,
248 snackbar: material::widget::snackbar::Transition::default(),
249 theme_controller: theme_picker::ThemeController::default(),
250 }
251 }Sourcepub fn from_utc_millis(millis: i64) -> Self
pub fn from_utc_millis(millis: i64) -> Self
Converts a UTC timestamp to the date at the start of that UTC day.
Sourcepub fn to_utc_millis(self) -> i64
pub fn to_utc_millis(self) -> i64
Converts this date to UTC milliseconds at the start of the day.
pub fn weekday(self) -> Weekday
Trait Implementations§
impl Copy for Date
impl Eq for Date
Source§impl Ord for Date
impl Ord for Date
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Date
impl PartialOrd for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnsafeUnpin for Date
impl UnwindSafe for Date
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.