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 212)
194 fn default() -> Self {
195 Self {
196 navigation: navigation::NavigationState::new(ShowcasePage::Inputs),
197 window_size: Size::new(1080.0, 980.0),
198 count: 0,
199 note: String::new(),
200 editor_content: material::widget::text_editor::Content::with_text(
201 "Material 3 multi-line text editor",
202 ),
203 select_choice: Some("Assist"),
204 combobox_options: material::widget::combobox::State::with_selection(
205 vec!["Assist", "Suggestion", "Filter"],
206 Some(&"Suggestion"),
207 ),
208 combobox_choice: Some("Suggestion"),
209 combobox_input: String::new(),
210 search_query: String::new(),
211 date_picker: material::widget::picker::DatePickerState::new(
212 material::widget::picker::Date::new(2026, 7, 4),
213 ),
214 date_range_picker: material::widget::picker::DateRangePickerState::new(
215 material::widget::picker::Date::new(2026, 7, 4),
216 material::widget::picker::Date::new(2026, 7, 10),
217 ),
218 time_picker: material::widget::picker::TimePickerState::new(14, 30, false),
219 progress: 42.0,
220 enabled: true,
221 radio_choice: Some(RadioChoice::Standard),
222 segment_choice: SegmentChoice::List,
223 segment_state: material::widget::segmented_button::State::new(
224 SegmentChoice::List.index(),
225 ),
226 primary_tab: TabChoice::Inputs,
227 primary_tab_state: material::widget::tabs::State::new(TabChoice::Inputs.index()),
228 secondary_tab: TabChoice::Controls,
229 secondary_tab_state: material::widget::tabs::State::new(TabChoice::Controls.index()),
230 progress_animation: material::widget::progress_bar::IndeterminateState::new(
231 Instant::now(),
232 ),
233 alert_dialog: material::widget::dialog::Transition::default(),
234 snackbar: material::widget::snackbar::Transition::default(),
235 theme_controller: theme_picker::ThemeController::default(),
236 }
237 }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
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.