```
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

source#### pub const fn previous(self) -> Self

#### pub const fn previous(self) -> Self

Get the previous weekday.

`assert_eq!(Weekday::Tuesday.previous(), Weekday::Monday);`

Runsource#### pub const fn next(self) -> Self

#### pub const fn next(self) -> Self

Get the next weekday.

`assert_eq!(Weekday::Monday.next(), Weekday::Tuesday);`

Runsource#### pub const fn nth_next(self, n: u8) -> Self

#### pub const fn nth_next(self, n: u8) -> Self

Get n-th next day.

```
assert_eq!(Weekday::Monday.nth_next(1), Weekday::Tuesday);
assert_eq!(Weekday::Sunday.nth_next(10), Weekday::Wednesday);
```

Runsource#### pub const fn nth_prev(self, n: u8) -> Self

#### pub const fn nth_prev(self, n: u8) -> Self

Get n-th previous day.

```
assert_eq!(Weekday::Monday.nth_prev(1), Weekday::Sunday);
assert_eq!(Weekday::Sunday.nth_prev(10), Weekday::Thursday);
```

Runsource#### pub 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);`

Runsource#### pub 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);`

Runsource#### pub 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);`

Runsource#### pub 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);`

Run## Trait Implementations§

source§### impl<'a> Deserialize<'a> for Weekday

Available on **crate feature **`serde`

only.

### impl<'a> Deserialize<'a> for Weekday

Available on

**crate feature**only.`serde`

source§#### fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>

#### fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more

source§#### fn deserialize_in_place<D>(
deserializer: D,
place: &mut Self
) -> Result<(), <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,

#### fn deserialize_in_place<D>( deserializer: D, place: &mut Self ) -> Result<(), <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,

Deserializes a value into

`self`

from the given Deserializer. Read moresource§### impl Distribution<Weekday> for Standard

Available on **crate feature **`rand`

only.

### impl Distribution<Weekday> for Standard

Available on

**crate feature**only.`rand`

source§#### fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Weekday

#### fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Weekday

Generate a random value of

`T`

, using `rng`

as the source of randomness.source§### impl PartialEq<Weekday> for Weekday

### impl PartialEq<Weekday> for Weekday

### impl Copy 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