pub struct MonthGrid { /* private fields */ }Expand description
One month’s 7-column day grid: how many blank leading cells precede the 1st, how many days the month has, and therefore how many week rows it occupies.
The reference computes the same three numbers inline in
M3EDayPicker.build; they are lifted into a value type here so the grid
layout can be asserted without painting.
Implementations§
Source§impl MonthGrid
impl MonthGrid
Sourcepub fn new(month: MaterialDate, first_day_of_week: u32) -> Self
pub fn new(month: MaterialDate, first_day_of_week: u32) -> Self
The grid for month’s own month (its day component is ignored), with
the week starting on first_day_of_week (0 Sunday .. 6 Saturday;
out-of-range values fold with % 7).
leading_blanks is the reference’s firstDayOffset, (weekday - firstDayOfWeekIndex) % 7, expressed over
MaterialDate::weekday_index’s already Sunday-folded index.
Sourcepub fn leading_blanks(self) -> usize
pub fn leading_blanks(self) -> usize
How many blank cells precede the 1st.
Sourcepub fn rows(self) -> usize
pub fn rows(self) -> usize
How many week rows the grid occupies — ceil((days + blanks) / 7),
always 4..=6 for a real month.
Sourcepub fn cell_count(self) -> usize
pub fn cell_count(self) -> usize
How many cells the grid holds, blanks included (rows * 7).
Sourcepub fn date_at(self, index: usize) -> Option<MaterialDate>
pub fn date_at(self, index: usize) -> Option<MaterialDate>
The date in cell index (row-major from the top-left), or None for a
leading blank or a trailing one past the month’s end.
Trait Implementations§
impl Copy for MonthGrid
impl Eq for MonthGrid
impl StructuralPartialEq for MonthGrid
Auto Trait Implementations§
impl Freeze for MonthGrid
impl RefUnwindSafe for MonthGrid
impl Send for MonthGrid
impl Sync for MonthGrid
impl Unpin for MonthGrid
impl UnsafeUnpin for MonthGrid
impl UnwindSafe for MonthGrid
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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)
&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)
&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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.