Skip to main content

Weekday

Enum Weekday 

Source
#[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§

§

Monday = 1

§

Tuesday = 2

§

Wednesday = 3

§

Thursday = 4

§

Friday = 5

§

Saturday = 6

§

Sunday = 7

Implementations§

Source§

impl Weekday

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Weekday

Source§

fn clone(&self) -> Weekday

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Weekday

Source§

impl Debug for Weekday

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Weekday

Source§

impl Format for Weekday

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl Hash for Weekday

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Weekday

Source§

fn eq(&self, other: &Weekday) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Weekday

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.