#[repr(u8)]pub enum Weekday {
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
Sunday = 7,
}Expand description
A representation for the day of the week.
Variants§
Implementations§
Source§impl Weekday
impl Weekday
Sourcepub const fn from_monday_zero_offset(offset: i8) -> Result<Weekday, RangeError>
pub const fn from_monday_zero_offset(offset: i8) -> Result<Weekday, RangeError>
Convert a 0-offset to a Weekday. Monday corresponds to offset 0 and
Sunday corresponds to offset 6.
Sourcepub const fn from_monday_one_offset(offset: i8) -> Result<Weekday, RangeError>
pub const fn from_monday_one_offset(offset: i8) -> Result<Weekday, RangeError>
Convert a 1-offset to a Weekday. Monday corresponds to offset 1 and
Sunday corresponds to offset 7.
Sourcepub const fn from_sunday_zero_offset(offset: i8) -> Result<Weekday, RangeError>
pub const fn from_sunday_zero_offset(offset: i8) -> Result<Weekday, RangeError>
Convert a 0-offset to a Weekday. Sunday corresponds to offset 0 and
Saturday corresponds to offset 6.
Sourcepub const fn from_sunday_one_offset(offset: i8) -> Result<Weekday, RangeError>
pub const fn from_sunday_one_offset(offset: i8) -> Result<Weekday, RangeError>
Convert a 1-offset to a Weekday. Sunday corresponds to offset 1 and
Saturday corresponds to offset 7.
Sourcepub const fn to_monday_zero_offset(self) -> i8
pub const fn to_monday_zero_offset(self) -> i8
Returns the weekday as a 0-offset. Monday corresponds to offset 0
and Sunday corresponds to offset 6.
Sourcepub const fn to_monday_one_offset(self) -> i8
pub const fn to_monday_one_offset(self) -> i8
Returns the weekday as a 1-offset. Monday corresponds to offset 1
and Sunday corresponds to offset 7.
Sourcepub const fn to_sunday_zero_offset(self) -> i8
pub const fn to_sunday_zero_offset(self) -> i8
Returns the weekday as a 0-offset. Sunday corresponds to offset 0
and Saturday corresponds to offset 6.
Sourcepub const fn to_sunday_one_offset(self) -> i8
pub const fn to_sunday_one_offset(self) -> i8
Returns the weekday as a 1-offset. Sunday corresponds to offset 1
and Saturday corresponds to offset 7.
Sourcepub const fn wrapping_add(self, days: i64) -> Weekday
pub const fn wrapping_add(self, days: i64) -> Weekday
Add the given number of days to this weekday, using wrapping arithmetic, and return the resulting weekday.
Adding a multiple of 7 (including 0) is guaranteed to produce the
same weekday as this one.
Sourcepub const fn wrapping_sub(self, days: i64) -> Weekday
pub const fn wrapping_sub(self, days: i64) -> Weekday
Subtract the given number of days from this weekday, using wrapping arithmetic, and return the resulting weekday.
Subtracting a multiple of 7 (including 0) is guaranteed to produce
the same weekday as this one.
Sourcepub const fn next(self) -> Weekday
pub const fn next(self) -> Weekday
Returns the next weekday, wrapping around at the end of week to the beginning of the week.
This is a convenience routing for calling Weekday::wrapping_add
with a value of 1.
Sourcepub const fn previous(self) -> Weekday
pub const fn previous(self) -> Weekday
Returns the previous weekday, wrapping around at the beginning of week to the end of the week.
This is a convenience routing for calling Weekday::wrapping_sub
with a value of 1.
Sourcepub const fn since(self, other: Weekday) -> i8
pub const fn since(self, other: Weekday) -> i8
Returns the number of days from other to this weekday.
Adding the returned number of days to other is guaranteed to sum to
this weekday. The number of days returned is guaranteed to be in the
range 0..=6.
Sourcepub const fn until(self, other: Weekday) -> i8
pub const fn until(self, other: Weekday) -> i8
Returns the number of days until other from this weekday.
Adding the returned number of days to this weekday is guaranteed to sum
to other weekday. The number of days returned is guaranteed to be in
the range 0..=6.
Sourcepub const fn cycle_forward(self) -> WeekdaysForward ⓘ
pub const fn cycle_forward(self) -> WeekdaysForward ⓘ
Starting with this weekday, this returns an unending iterator that cycles forward through the days of the week.
Sourcepub const fn cycle_reverse(self) -> WeekdaysReverse ⓘ
pub const fn cycle_reverse(self) -> WeekdaysReverse ⓘ
Starting with this weekday, this returns an unending iterator that cycles backward through the days of the week.