Enum Weekday
#[repr(u8)]
pub enum Weekday
A representation for the day of the week.
Variants
-
Monday = 1 -
Tuesday = 2 -
Wednesday = 3 -
Thursday = 4 -
Friday = 5 -
Saturday = 6 -
Sunday = 7
Implementations
impl Weekday
const fn from_monday_zero_offset(offset: i8) -> Result<Weekday, RangeError>Convert a 0-offset to a
Weekday. Monday corresponds to offset0and Sunday corresponds to offset6.const fn from_monday_one_offset(offset: i8) -> Result<Weekday, RangeError>Convert a 1-offset to a
Weekday. Monday corresponds to offset1and Sunday corresponds to offset7.const fn from_sunday_zero_offset(offset: i8) -> Result<Weekday, RangeError>Convert a 0-offset to a
Weekday. Sunday corresponds to offset0and Saturday corresponds to offset6.const fn from_sunday_one_offset(offset: i8) -> Result<Weekday, RangeError>Convert a 1-offset to a
Weekday. Sunday corresponds to offset1and Saturday corresponds to offset7.const fn to_monday_zero_offset(self) -> i8Returns the weekday as a 0-offset. Monday corresponds to offset
0and Sunday corresponds to offset6.const fn to_monday_one_offset(self) -> i8Returns the weekday as a 1-offset. Monday corresponds to offset
1and Sunday corresponds to offset7.const fn to_sunday_zero_offset(self) -> i8Returns the weekday as a 0-offset. Sunday corresponds to offset
0and Saturday corresponds to offset6.const fn to_sunday_one_offset(self) -> i8Returns the weekday as a 1-offset. Sunday corresponds to offset
1and Saturday corresponds to offset7.const fn wrapping_add(self, days: i64) -> WeekdayAdd the given number of days to this weekday, using wrapping arithmetic, and return the resulting weekday.
Adding a multiple of
7(including0) is guaranteed to produce the same weekday as this one.const fn wrapping_sub(self, days: i64) -> WeekdaySubtract the given number of days from this weekday, using wrapping arithmetic, and return the resulting weekday.
Subtracting a multiple of
7(including0) is guaranteed to produce the same weekday as this one.const fn next(self) -> WeekdayReturns 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_addwith a value of1.const fn previous(self) -> WeekdayReturns 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_subwith a value of1.const fn since(self, other: Weekday) -> i8Returns the number of days from
otherto this weekday.Adding the returned number of days to
otheris guaranteed to sum to this weekday. The number of days returned is guaranteed to be in the range0..=6.const fn until(self, other: Weekday) -> i8Returns the number of days until
otherfrom this weekday.Adding the returned number of days to this weekday is guaranteed to sum to
otherweekday. The number of days returned is guaranteed to be in the range0..=6.const fn cycle_forward(self) -> WeekdaysForwardStarting with this weekday, this returns an unending iterator that cycles forward through the days of the week.
const fn cycle_reverse(self) -> WeekdaysReverseStarting with this weekday, this returns an unending iterator that cycles backward through the days of the week.
Trait Implementations
impl Clone for Weekday
fn clone(&self) -> Self
impl Copy for Weekday
impl Debug for Weekday
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Weekday
impl Hash for Weekday
fn hash<__H: Hasher>(&self, state: &mut __H)
impl PartialEq for Weekday
fn eq(&self, other: &Self) -> bool