pub enum Weekday {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
}
Expand description
Days of the week.
As order is dependent on context (Sunday could be either two days after or five days before
Friday), this type does not implement PartialOrd
or Ord
.
Variants§
Implementations§
source§impl Weekday
impl Weekday
sourcepub const fn previous(self) -> Weekday
pub const fn previous(self) -> Weekday
Get the previous weekday.
assert_eq!(Weekday::Tuesday.previous(), Weekday::Monday);
sourcepub const fn next(self) -> Weekday
pub const fn next(self) -> Weekday
Get the next weekday.
assert_eq!(Weekday::Monday.next(), Weekday::Tuesday);
sourcepub const fn number_from_monday(self) -> u8
pub const fn number_from_monday(self) -> u8
Get the one-indexed number of days from Monday.
assert_eq!(Weekday::Monday.number_from_monday(), 1);
sourcepub const fn number_from_sunday(self) -> u8
pub const fn number_from_sunday(self) -> u8
Get the one-indexed number of days from Sunday.
assert_eq!(Weekday::Monday.number_from_sunday(), 2);
sourcepub const fn number_days_from_monday(self) -> u8
pub const fn number_days_from_monday(self) -> u8
Get the zero-indexed number of days from Monday.
assert_eq!(Weekday::Monday.number_days_from_monday(), 0);
sourcepub const fn number_days_from_sunday(self) -> u8
pub const fn number_days_from_sunday(self) -> u8
Get the zero-indexed number of days from Sunday.
assert_eq!(Weekday::Monday.number_days_from_sunday(), 1);
Trait Implementations§
source§impl PartialEq<Weekday> for Weekday
impl PartialEq<Weekday> for Weekday
impl Copy for Weekday
impl Eq for Weekday
impl StructuralEq for Weekday
impl StructuralPartialEq for Weekday
Auto Trait Implementations§
impl RefUnwindSafe for Weekday
impl Send for Weekday
impl Sync for Weekday
impl Unpin for Weekday
impl UnwindSafe for Weekday
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
Mutably borrows from an owned value. Read more
source§impl<T> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere T: Hash + ?Sized,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.