[−][src]Struct doomsday::Doomsday
Behold the 💥 doomsday of a year
Every year has a single doomsday, for example Doomsday(2020)
is
Saturday
. Additionally, each month has fixed day number for which
doomsday lies, for example, in April
doomsday is always on the 4th. Given
these two peices of information, it's possible to quickly determain the day
of any date.
Years before FIRST_LEAP_YEAR
aren't supported.
Methods
impl Doomsday
[src]
pub fn new(year: usize) -> Doomsday
[src]
Create a new doomsday for a given year. TODO: Random or something?
pub fn anchor(&self, month: Month) -> usize
[src]
Return the day number, of the anchor doomsday in a given month.
This is the main utility of this crate. Notice how there are really only a few mnemonics to memorize here:
- 4/4, 6/6, 8/8, 10/10, and 12/12
- 9 to 5 at 7-Eleven
- The last day of February (twice)
- 3 for three years, then 4 on the forth.
These tricks are listed again below for each appropriate month.
pub fn day(&self) -> Day
[src]
Return the day of the week which doomsday lies on in a given year.
Trait Implementations
impl Debug for Doomsday
[src]
impl Display for Doomsday
[src]
The display of doomsday is day, one for every week if you wish.
Auto Trait Implementations
impl RefUnwindSafe for Doomsday
impl Send for Doomsday
impl Sync for Doomsday
impl Unpin for Doomsday
impl UnwindSafe for Doomsday
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,