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) -> Weekday
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: &Weekday) -> bool
impl StructuralPartialEq for Weekday
Auto Trait Implementations
impl Freeze for Weekday
impl RefUnwindSafe for Weekday
impl Send for Weekday
impl Sync for Weekday
impl Unpin for Weekday
impl UnsafeUnpin for Weekday
impl UnwindSafe for Weekday
Blanket Implementations
impl<T> Any for Weekday
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Weekday
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Weekday
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Weekday
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Weekday
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Weekday
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Weekday
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Weekday
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Weekday
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>