Enum nichi::Day

source ·
#[repr(u8)]
pub enum Day {
Show 31 variants First = 1, Second = 2, Third = 3, Fourth = 4, Fifth = 5, Sixth = 6, Seventh = 7, Eighth = 8, Ninth = 9, Tenth = 10, Eleventh = 11, Twelfth = 12, Thirteenth = 13, Fourteenth = 14, Fifteenth = 15, Sixteenth = 16, Seventeenth = 17, Eighteenth = 18, Nineteenth = 19, Twentieth = 20, TwentyFirst = 21, TwentySecond = 22, TwentyThird = 23, TwentyFourth = 24, TwentyFifth = 25, TwentySixth = 26, TwentySeventh = 27, TwentyEighth = 28, TwentyNinth = 29, Thirtieth = 30, ThirtyFirst = 31,
}
Expand description

Day of the month

Variants§

§

First = 1

§

Second = 2

§

Third = 3

§

Fourth = 4

§

Fifth = 5

§

Sixth = 6

§

Seventh = 7

§

Eighth = 8

§

Ninth = 9

§

Tenth = 10

§

Eleventh = 11

§

Twelfth = 12

§

Thirteenth = 13

§

Fourteenth = 14

§

Fifteenth = 15

§

Sixteenth = 16

§

Seventeenth = 17

§

Eighteenth = 18

§

Nineteenth = 19

§

Twentieth = 20

§

TwentyFirst = 21

§

TwentySecond = 22

§

TwentyThird = 23

§

TwentyFourth = 24

§

TwentyFifth = 25

§

TwentySixth = 26

§

TwentySeventh = 27

§

TwentyEighth = 28

§

TwentyNinth = 29

§

Thirtieth = 30

§

ThirtyFirst = 31

Implementations§

source§

impl Day

source

pub const FIRST: Day = Day::First

assert_eq!(Day::FIRST, Day::First);
source

pub const LAST: Day = Day::ThirtyFirst

assert_eq!(Day::LAST, Day::ThirtyFirst);
source

pub const ALL: [Day; 31] = _

assert_eq!(Day::ALL[0],  Day::First);
assert_eq!(Day::ALL[1],  Day::Second);
assert_eq!(Day::ALL[2],  Day::Third);
assert_eq!(Day::ALL[3],  Day::Fourth);
assert_eq!(Day::ALL[4],  Day::Fifth);
assert_eq!(Day::ALL[5],  Day::Sixth);
assert_eq!(Day::ALL[6],  Day::Seventh);
assert_eq!(Day::ALL[7],  Day::Eighth);
assert_eq!(Day::ALL[8],  Day::Ninth);
assert_eq!(Day::ALL[9],  Day::Tenth);
assert_eq!(Day::ALL[10], Day::Eleventh);
assert_eq!(Day::ALL[11], Day::Twelfth);
assert_eq!(Day::ALL[12], Day::Thirteenth);
assert_eq!(Day::ALL[13], Day::Fourteenth);
assert_eq!(Day::ALL[14], Day::Fifteenth);
assert_eq!(Day::ALL[15], Day::Sixteenth);
assert_eq!(Day::ALL[16], Day::Seventeenth);
assert_eq!(Day::ALL[17], Day::Eighteenth);
assert_eq!(Day::ALL[18], Day::Nineteenth);
assert_eq!(Day::ALL[19], Day::Twentieth);
assert_eq!(Day::ALL[20], Day::TwentyFirst);
assert_eq!(Day::ALL[21], Day::TwentySecond);
assert_eq!(Day::ALL[22], Day::TwentyThird);
assert_eq!(Day::ALL[23], Day::TwentyFourth);
assert_eq!(Day::ALL[24], Day::TwentyFifth);
assert_eq!(Day::ALL[25], Day::TwentySixth);
assert_eq!(Day::ALL[26], Day::TwentySeventh);
assert_eq!(Day::ALL[27], Day::TwentyEighth);
assert_eq!(Day::ALL[28], Day::TwentyNinth);
assert_eq!(Day::ALL[29], Day::Thirtieth);
assert_eq!(Day::ALL[30], Day::ThirtyFirst);
source

pub const fn new(day: u8) -> Self

assert_eq!(Day::new(1),  Day::First);
assert_eq!(Day::new(2),  Day::Second);
assert_eq!(Day::new(3),  Day::Third);
assert_eq!(Day::new(4),  Day::Fourth);
assert_eq!(Day::new(5),  Day::Fifth);
assert_eq!(Day::new(6),  Day::Sixth);
assert_eq!(Day::new(7),  Day::Seventh);
assert_eq!(Day::new(8),  Day::Eighth);
assert_eq!(Day::new(9),  Day::Ninth);
assert_eq!(Day::new(10), Day::Tenth);
assert_eq!(Day::new(11), Day::Eleventh);
assert_eq!(Day::new(12), Day::Twelfth);
assert_eq!(Day::new(13), Day::Thirteenth);
assert_eq!(Day::new(14), Day::Fourteenth);
assert_eq!(Day::new(15), Day::Fifteenth);
assert_eq!(Day::new(16), Day::Sixteenth);
assert_eq!(Day::new(17), Day::Seventeenth);
assert_eq!(Day::new(18), Day::Eighteenth);
assert_eq!(Day::new(19), Day::Nineteenth);
assert_eq!(Day::new(20), Day::Twentieth);
assert_eq!(Day::new(21), Day::TwentyFirst);
assert_eq!(Day::new(22), Day::TwentySecond);
assert_eq!(Day::new(23), Day::TwentyThird);
assert_eq!(Day::new(24), Day::TwentyFourth);
assert_eq!(Day::new(25), Day::TwentyFifth);
assert_eq!(Day::new(26), Day::TwentySixth);
assert_eq!(Day::new(27), Day::TwentySeventh);
assert_eq!(Day::new(28), Day::TwentyEighth);
assert_eq!(Day::new(29), Day::TwentyNinth);
assert_eq!(Day::new(30), Day::Thirtieth);
assert_eq!(Day::new(31), Day::ThirtyFirst);
Day::new(0);
Day::new(32);
source

pub const fn new_saturating(day: u8) -> Self

assert_eq!(Day::new_saturating(1),  Day::First);
assert_eq!(Day::new_saturating(2),  Day::Second);
assert_eq!(Day::new_saturating(3),  Day::Third);
assert_eq!(Day::new_saturating(4),  Day::Fourth);
assert_eq!(Day::new_saturating(5),  Day::Fifth);
assert_eq!(Day::new_saturating(6),  Day::Sixth);
assert_eq!(Day::new_saturating(7),  Day::Seventh);
assert_eq!(Day::new_saturating(8),  Day::Eighth);
assert_eq!(Day::new_saturating(9),  Day::Ninth);
assert_eq!(Day::new_saturating(10), Day::Tenth);
assert_eq!(Day::new_saturating(11), Day::Eleventh);
assert_eq!(Day::new_saturating(12), Day::Twelfth);
assert_eq!(Day::new_saturating(13), Day::Thirteenth);
assert_eq!(Day::new_saturating(14), Day::Fourteenth);
assert_eq!(Day::new_saturating(15), Day::Fifteenth);
assert_eq!(Day::new_saturating(16), Day::Sixteenth);
assert_eq!(Day::new_saturating(17), Day::Seventeenth);
assert_eq!(Day::new_saturating(18), Day::Eighteenth);
assert_eq!(Day::new_saturating(19), Day::Nineteenth);
assert_eq!(Day::new_saturating(20), Day::Twentieth);
assert_eq!(Day::new_saturating(21), Day::TwentyFirst);
assert_eq!(Day::new_saturating(22), Day::TwentySecond);
assert_eq!(Day::new_saturating(23), Day::TwentyThird);
assert_eq!(Day::new_saturating(24), Day::TwentyFourth);
assert_eq!(Day::new_saturating(25), Day::TwentyFifth);
assert_eq!(Day::new_saturating(26), Day::TwentySixth);
assert_eq!(Day::new_saturating(27), Day::TwentySeventh);
assert_eq!(Day::new_saturating(28), Day::TwentyEighth);
assert_eq!(Day::new_saturating(29), Day::TwentyNinth);
assert_eq!(Day::new_saturating(30), Day::Thirtieth);
assert_eq!(Day::new_saturating(31), Day::ThirtyFirst);
assert_eq!(Day::new_saturating(0),  Day::First);
assert_eq!(Day::new_saturating(32),  Day::ThirtyFirst);
assert_eq!(Day::new_saturating(33),  Day::ThirtyFirst);
source

pub const fn new_wrapping(day: u8) -> Self

// Wraps to 31st
assert_eq!(Day::new_wrapping(0),  Day::ThirtyFirst);

assert_eq!(Day::new_wrapping(1),  Day::First);
assert_eq!(Day::new_wrapping(2),  Day::Second);
assert_eq!(Day::new_wrapping(3),  Day::Third);
assert_eq!(Day::new_wrapping(4),  Day::Fourth);
assert_eq!(Day::new_wrapping(5),  Day::Fifth);
assert_eq!(Day::new_wrapping(6),  Day::Sixth);
assert_eq!(Day::new_wrapping(7),  Day::Seventh);
assert_eq!(Day::new_wrapping(8),  Day::Eighth);
assert_eq!(Day::new_wrapping(9),  Day::Ninth);
assert_eq!(Day::new_wrapping(10), Day::Tenth);
assert_eq!(Day::new_wrapping(11), Day::Eleventh);
assert_eq!(Day::new_wrapping(12), Day::Twelfth);
assert_eq!(Day::new_wrapping(13), Day::Thirteenth);
assert_eq!(Day::new_wrapping(14), Day::Fourteenth);
assert_eq!(Day::new_wrapping(15), Day::Fifteenth);
assert_eq!(Day::new_wrapping(16), Day::Sixteenth);
assert_eq!(Day::new_wrapping(17), Day::Seventeenth);
assert_eq!(Day::new_wrapping(18), Day::Eighteenth);
assert_eq!(Day::new_wrapping(19), Day::Nineteenth);
assert_eq!(Day::new_wrapping(20), Day::Twentieth);
assert_eq!(Day::new_wrapping(21), Day::TwentyFirst);
assert_eq!(Day::new_wrapping(22), Day::TwentySecond);
assert_eq!(Day::new_wrapping(23), Day::TwentyThird);
assert_eq!(Day::new_wrapping(24), Day::TwentyFourth);
assert_eq!(Day::new_wrapping(25), Day::TwentyFifth);
assert_eq!(Day::new_wrapping(26), Day::TwentySixth);
assert_eq!(Day::new_wrapping(27), Day::TwentySeventh);
assert_eq!(Day::new_wrapping(28), Day::TwentyEighth);
assert_eq!(Day::new_wrapping(29), Day::TwentyNinth);
assert_eq!(Day::new_wrapping(30), Day::Thirtieth);
assert_eq!(Day::new_wrapping(31), Day::ThirtyFirst);

// Wraps to 1st, 2nd, etc
assert_eq!(Day::new_wrapping(32), Day::First);
assert_eq!(Day::new_wrapping(33), Day::Second);
assert_eq!(Day::new_wrapping(34), Day::Third);
assert_eq!(Day::new_wrapping(35), Day::Fourth);
assert_eq!(Day::new_wrapping(36), Day::Fifth);
assert_eq!(Day::new_wrapping(37), Day::Sixth);
assert_eq!(Day::new_wrapping(38), Day::Seventh);
assert_eq!(Day::new_wrapping(39), Day::Eighth);
assert_eq!(Day::new_wrapping(40), Day::Ninth);
assert_eq!(Day::new_wrapping(41), Day::Tenth);
assert_eq!(Day::new_wrapping(42), Day::Eleventh);
assert_eq!(Day::new_wrapping(43), Day::Twelfth);
assert_eq!(Day::new_wrapping(44), Day::Thirteenth);
assert_eq!(Day::new_wrapping(45), Day::Fourteenth);
assert_eq!(Day::new_wrapping(46), Day::Fifteenth);
assert_eq!(Day::new_wrapping(47), Day::Sixteenth);
assert_eq!(Day::new_wrapping(48), Day::Seventeenth);
assert_eq!(Day::new_wrapping(49), Day::Eighteenth);
assert_eq!(Day::new_wrapping(50), Day::Nineteenth);
assert_eq!(Day::new_wrapping(51), Day::Twentieth);
assert_eq!(Day::new_wrapping(52), Day::TwentyFirst);
assert_eq!(Day::new_wrapping(53), Day::TwentySecond);
assert_eq!(Day::new_wrapping(54), Day::TwentyThird);
assert_eq!(Day::new_wrapping(55), Day::TwentyFourth);
assert_eq!(Day::new_wrapping(56), Day::TwentyFifth);
assert_eq!(Day::new_wrapping(57), Day::TwentySixth);
assert_eq!(Day::new_wrapping(58), Day::TwentySeventh);
assert_eq!(Day::new_wrapping(59), Day::TwentyEighth);
assert_eq!(Day::new_wrapping(60), Day::TwentyNinth);
assert_eq!(Day::new_wrapping(61), Day::Thirtieth);
assert_eq!(Day::new_wrapping(62), Day::ThirtyFirst);
source

pub const fn as_u8(self) -> u8

Turn Self into its u8 representation

source

pub const fn next_saturating(self) -> Self

Get the next Self, saturating if we’re at Self::LAST

source

pub const fn next_wrapping(self) -> Self

Get the next Self, wrapping if we’re at Self::LAST

source

pub const fn previous_saturating(self) -> Self

Get the previous Self, saturating if we’re at Self::FIRST

source

pub const fn previous_wrapping(self) -> Self

Get the previous Self, wrapping if we’re at Self::FIRST

source

pub const fn add_saturating(self, rhs: u8) -> Self

Add onto Self, saturating if we’re at Self::LAST

source

pub const fn sub_saturating(self, rhs: u8) -> Self

Subtract from Self, saturating if we’re at Self::FIRST

source

pub const fn add_wrapping(self, rhs: u8) -> Self

Add onto Self, wrapping if we’re at Self::LAST

source

pub const fn sub_wrapping(self, rhs: u8) -> Self

Subtract from Self, wrapping if we’re at Self::FIRST

source

pub const fn as_str_num(self) -> &'static str

assert_eq!(Day::First.as_str_num()         , "1");
assert_eq!(Day::Second.as_str_num()        , "2");
assert_eq!(Day::Third.as_str_num()         , "3");
assert_eq!(Day::Fourth.as_str_num()        , "4");
assert_eq!(Day::Fifth.as_str_num()         , "5");
assert_eq!(Day::Sixth.as_str_num()         , "6");
assert_eq!(Day::Seventh.as_str_num()       , "7");
assert_eq!(Day::Eighth.as_str_num()        , "8");
assert_eq!(Day::Ninth.as_str_num()         , "9");
assert_eq!(Day::Tenth.as_str_num()         , "10");
assert_eq!(Day::Eleventh.as_str_num()      , "11");
assert_eq!(Day::Twelfth.as_str_num()       , "12");
assert_eq!(Day::Thirteenth.as_str_num()    , "13");
assert_eq!(Day::Fourteenth.as_str_num()    , "14");
assert_eq!(Day::Fifteenth.as_str_num()     , "15");
assert_eq!(Day::Sixteenth.as_str_num()     , "16");
assert_eq!(Day::Seventeenth.as_str_num()   , "17");
assert_eq!(Day::Eighteenth.as_str_num()    , "18");
assert_eq!(Day::Nineteenth.as_str_num()    , "19");
assert_eq!(Day::Twentieth.as_str_num()     , "20");
assert_eq!(Day::TwentyFirst.as_str_num()   , "21");
assert_eq!(Day::TwentySecond.as_str_num()  , "22");
assert_eq!(Day::TwentyThird.as_str_num()   , "23");
assert_eq!(Day::TwentyFourth.as_str_num()  , "24");
assert_eq!(Day::TwentyFifth.as_str_num()   , "25");
assert_eq!(Day::TwentySixth.as_str_num()   , "26");
assert_eq!(Day::TwentySeventh.as_str_num() , "27");
assert_eq!(Day::TwentyEighth.as_str_num()  , "28");
assert_eq!(Day::TwentyNinth.as_str_num()   , "29");
assert_eq!(Day::Thirtieth.as_str_num()     , "30");
assert_eq!(Day::ThirtyFirst.as_str_num()   , "31");
source

pub const fn as_str_ordinal(self) -> &'static str

assert_eq!(Day::First.as_str_ordinal()          , "First");
assert_eq!(Day::Second.as_str_ordinal()         , "Second");
assert_eq!(Day::Third.as_str_ordinal()          , "Third");
assert_eq!(Day::Fourth.as_str_ordinal()         , "Fourth");
assert_eq!(Day::Fifth.as_str_ordinal()          , "Fifth");
assert_eq!(Day::Sixth.as_str_ordinal()          , "Sixth");
assert_eq!(Day::Seventh.as_str_ordinal()        , "Seventh");
assert_eq!(Day::Eighth.as_str_ordinal()         , "Eighth");
assert_eq!(Day::Ninth.as_str_ordinal()          , "Ninth");
assert_eq!(Day::Tenth.as_str_ordinal()          , "Tenth");
assert_eq!(Day::Eleventh.as_str_ordinal()       , "Eleventh");
assert_eq!(Day::Twelfth.as_str_ordinal()        , "Twelfth");
assert_eq!(Day::Thirteenth.as_str_ordinal()     , "Thirteenth");
assert_eq!(Day::Fourteenth.as_str_ordinal()     , "Fourteenth");
assert_eq!(Day::Fifteenth.as_str_ordinal()      , "Fifteenth");
assert_eq!(Day::Sixteenth.as_str_ordinal()      , "Sixteenth");
assert_eq!(Day::Seventeenth.as_str_ordinal()    , "Seventeenth");
assert_eq!(Day::Eighteenth.as_str_ordinal()     , "Eighteenth");
assert_eq!(Day::Nineteenth.as_str_ordinal()     , "Nineteenth");
assert_eq!(Day::Twentieth.as_str_ordinal()      , "Twentieth");
assert_eq!(Day::TwentyFirst.as_str_ordinal()    , "TwentyFirst");
assert_eq!(Day::TwentySecond.as_str_ordinal()   , "TwentySecond");
assert_eq!(Day::TwentyThird.as_str_ordinal()    , "TwentyThird");
assert_eq!(Day::TwentyFourth.as_str_ordinal()   , "TwentyFourth");
assert_eq!(Day::TwentyFifth.as_str_ordinal()    , "TwentyFifth");
assert_eq!(Day::TwentySixth.as_str_ordinal()    , "TwentySixth");
assert_eq!(Day::TwentySeventh.as_str_ordinal()  , "TwentySeventh");
assert_eq!(Day::TwentyEighth.as_str_ordinal()   , "TwentyEighth");
assert_eq!(Day::TwentyNinth.as_str_ordinal()    , "TwentyNinth");
assert_eq!(Day::Thirtieth.as_str_ordinal()      , "Thirtieth");
assert_eq!(Day::ThirtyFirst.as_str_ordinal()    , "ThirtyFirst");
source

pub const fn as_str_ordinal_lower(self) -> &'static str

assert_eq!(Day::First.as_str_ordinal_lower()          , "first");
assert_eq!(Day::Second.as_str_ordinal_lower()         , "second");
assert_eq!(Day::Third.as_str_ordinal_lower()          , "third");
assert_eq!(Day::Fourth.as_str_ordinal_lower()         , "fourth");
assert_eq!(Day::Fifth.as_str_ordinal_lower()          , "fifth");
assert_eq!(Day::Sixth.as_str_ordinal_lower()          , "sixth");
assert_eq!(Day::Seventh.as_str_ordinal_lower()        , "seventh");
assert_eq!(Day::Eighth.as_str_ordinal_lower()         , "eighth");
assert_eq!(Day::Ninth.as_str_ordinal_lower()          , "ninth");
assert_eq!(Day::Tenth.as_str_ordinal_lower()          , "tenth");
assert_eq!(Day::Eleventh.as_str_ordinal_lower()       , "eleventh");
assert_eq!(Day::Twelfth.as_str_ordinal_lower()        , "twelfth");
assert_eq!(Day::Thirteenth.as_str_ordinal_lower()     , "thirteenth");
assert_eq!(Day::Fourteenth.as_str_ordinal_lower()     , "fourteenth");
assert_eq!(Day::Fifteenth.as_str_ordinal_lower()      , "fifteenth");
assert_eq!(Day::Sixteenth.as_str_ordinal_lower()      , "sixteenth");
assert_eq!(Day::Seventeenth.as_str_ordinal_lower()    , "seventeenth");
assert_eq!(Day::Eighteenth.as_str_ordinal_lower()     , "eighteenth");
assert_eq!(Day::Nineteenth.as_str_ordinal_lower()     , "nineteenth");
assert_eq!(Day::Twentieth.as_str_ordinal_lower()      , "twentieth");
assert_eq!(Day::TwentyFirst.as_str_ordinal_lower()    , "twentyfirst");
assert_eq!(Day::TwentySecond.as_str_ordinal_lower()   , "twentysecond");
assert_eq!(Day::TwentyThird.as_str_ordinal_lower()    , "twentythird");
assert_eq!(Day::TwentyFourth.as_str_ordinal_lower()   , "twentyfourth");
assert_eq!(Day::TwentyFifth.as_str_ordinal_lower()    , "twentyfifth");
assert_eq!(Day::TwentySixth.as_str_ordinal_lower()    , "twentysixth");
assert_eq!(Day::TwentySeventh.as_str_ordinal_lower()  , "twentyseventh");
assert_eq!(Day::TwentyEighth.as_str_ordinal_lower()   , "twentyeighth");
assert_eq!(Day::TwentyNinth.as_str_ordinal_lower()    , "twentyninth");
assert_eq!(Day::Thirtieth.as_str_ordinal_lower()      , "thirtieth");
assert_eq!(Day::ThirtyFirst.as_str_ordinal_lower()    , "thirtyfirst");
source

pub const fn as_str_ordinal_upper(self) -> &'static str

assert_eq!(Day::First.as_str_ordinal_upper()          , "FIRST");
assert_eq!(Day::Second.as_str_ordinal_upper()         , "SECOND");
assert_eq!(Day::Third.as_str_ordinal_upper()          , "THIRD");
assert_eq!(Day::Fourth.as_str_ordinal_upper()         , "FOURTH");
assert_eq!(Day::Fifth.as_str_ordinal_upper()          , "FIFTH");
assert_eq!(Day::Sixth.as_str_ordinal_upper()          , "SIXTH");
assert_eq!(Day::Seventh.as_str_ordinal_upper()        , "SEVENTH");
assert_eq!(Day::Eighth.as_str_ordinal_upper()         , "EIGHTH");
assert_eq!(Day::Ninth.as_str_ordinal_upper()          , "NINTH");
assert_eq!(Day::Tenth.as_str_ordinal_upper()          , "TENTH");
assert_eq!(Day::Eleventh.as_str_ordinal_upper()       , "ELEVENTH");
assert_eq!(Day::Twelfth.as_str_ordinal_upper()        , "TWELFTH");
assert_eq!(Day::Thirteenth.as_str_ordinal_upper()     , "THIRTEENTH");
assert_eq!(Day::Fourteenth.as_str_ordinal_upper()     , "FOURTEENTH");
assert_eq!(Day::Fifteenth.as_str_ordinal_upper()      , "FIFTEENTH");
assert_eq!(Day::Sixteenth.as_str_ordinal_upper()      , "SIXTEENTH");
assert_eq!(Day::Seventeenth.as_str_ordinal_upper()    , "SEVENTEENTH");
assert_eq!(Day::Eighteenth.as_str_ordinal_upper()     , "EIGHTEENTH");
assert_eq!(Day::Nineteenth.as_str_ordinal_upper()     , "NINETEENTH");
assert_eq!(Day::Twentieth.as_str_ordinal_upper()      , "TWENTIETH");
assert_eq!(Day::TwentyFirst.as_str_ordinal_upper()    , "TWENTYFIRST");
assert_eq!(Day::TwentySecond.as_str_ordinal_upper()   , "TWENTYSECOND");
assert_eq!(Day::TwentyThird.as_str_ordinal_upper()    , "TWENTYTHIRD");
assert_eq!(Day::TwentyFourth.as_str_ordinal_upper()   , "TWENTYFOURTH");
assert_eq!(Day::TwentyFifth.as_str_ordinal_upper()    , "TWENTYFIFTH");
assert_eq!(Day::TwentySixth.as_str_ordinal_upper()    , "TWENTYSIXTH");
assert_eq!(Day::TwentySeventh.as_str_ordinal_upper()  , "TWENTYSEVENTH");
assert_eq!(Day::TwentyEighth.as_str_ordinal_upper()   , "TWENTYEIGHTH");
assert_eq!(Day::TwentyNinth.as_str_ordinal_upper()    , "TWENTYNINTH");
assert_eq!(Day::Thirtieth.as_str_ordinal_upper()      , "THIRTIETH");
assert_eq!(Day::ThirtyFirst.as_str_ordinal_upper()    , "THIRTYFIRST");
source

pub const fn as_str_num_ordinal(self) -> &'static str

assert_eq!(Day::First.as_str_num_ordinal()         , "1st");
assert_eq!(Day::Second.as_str_num_ordinal()        , "2nd");
assert_eq!(Day::Third.as_str_num_ordinal()         , "3rd");
assert_eq!(Day::Fourth.as_str_num_ordinal()        , "4th");
assert_eq!(Day::Fifth.as_str_num_ordinal()         , "5th");
assert_eq!(Day::Sixth.as_str_num_ordinal()         , "6th");
assert_eq!(Day::Seventh.as_str_num_ordinal()       , "7th");
assert_eq!(Day::Eighth.as_str_num_ordinal()        , "8th");
assert_eq!(Day::Ninth.as_str_num_ordinal()         , "9th");
assert_eq!(Day::Tenth.as_str_num_ordinal()         , "10th");
assert_eq!(Day::Eleventh.as_str_num_ordinal()      , "11th");
assert_eq!(Day::Twelfth.as_str_num_ordinal()       , "12th");
assert_eq!(Day::Thirteenth.as_str_num_ordinal()    , "13th");
assert_eq!(Day::Fourteenth.as_str_num_ordinal()    , "14th");
assert_eq!(Day::Fifteenth.as_str_num_ordinal()     , "15th");
assert_eq!(Day::Sixteenth.as_str_num_ordinal()     , "16th");
assert_eq!(Day::Seventeenth.as_str_num_ordinal()   , "17th");
assert_eq!(Day::Eighteenth.as_str_num_ordinal()    , "18th");
assert_eq!(Day::Nineteenth.as_str_num_ordinal()    , "19th");
assert_eq!(Day::Twentieth.as_str_num_ordinal()     , "20th");
assert_eq!(Day::TwentyFirst.as_str_num_ordinal()   , "21st");
assert_eq!(Day::TwentySecond.as_str_num_ordinal()  , "22nd");
assert_eq!(Day::TwentyThird.as_str_num_ordinal()   , "23rd");
assert_eq!(Day::TwentyFourth.as_str_num_ordinal()  , "24th");
assert_eq!(Day::TwentyFifth.as_str_num_ordinal()   , "25th");
assert_eq!(Day::TwentySixth.as_str_num_ordinal()   , "26th");
assert_eq!(Day::TwentySeventh.as_str_num_ordinal() , "27th");
assert_eq!(Day::TwentyEighth.as_str_num_ordinal()  , "28th");
assert_eq!(Day::TwentyNinth.as_str_num_ordinal()   , "29th");
assert_eq!(Day::Thirtieth.as_str_num_ordinal()     , "30th");
assert_eq!(Day::ThirtyFirst.as_str_num_ordinal()   , "31st");
source

pub const fn as_str_num_ordinal_upper(self) -> &'static str

assert_eq!(Day::First.as_str_num_ordinal_upper()         , "1ST");
assert_eq!(Day::Second.as_str_num_ordinal_upper()        , "2ND");
assert_eq!(Day::Third.as_str_num_ordinal_upper()         , "3RD");
assert_eq!(Day::Fourth.as_str_num_ordinal_upper()        , "4TH");
assert_eq!(Day::Fifth.as_str_num_ordinal_upper()         , "5TH");
assert_eq!(Day::Sixth.as_str_num_ordinal_upper()         , "6TH");
assert_eq!(Day::Seventh.as_str_num_ordinal_upper()       , "7TH");
assert_eq!(Day::Eighth.as_str_num_ordinal_upper()        , "8TH");
assert_eq!(Day::Ninth.as_str_num_ordinal_upper()         , "9TH");
assert_eq!(Day::Tenth.as_str_num_ordinal_upper()         , "10TH");
assert_eq!(Day::Eleventh.as_str_num_ordinal_upper()      , "11TH");
assert_eq!(Day::Twelfth.as_str_num_ordinal_upper()       , "12TH");
assert_eq!(Day::Thirteenth.as_str_num_ordinal_upper()    , "13TH");
assert_eq!(Day::Fourteenth.as_str_num_ordinal_upper()    , "14TH");
assert_eq!(Day::Fifteenth.as_str_num_ordinal_upper()     , "15TH");
assert_eq!(Day::Sixteenth.as_str_num_ordinal_upper()     , "16TH");
assert_eq!(Day::Seventeenth.as_str_num_ordinal_upper()   , "17TH");
assert_eq!(Day::Eighteenth.as_str_num_ordinal_upper()    , "18TH");
assert_eq!(Day::Nineteenth.as_str_num_ordinal_upper()    , "19TH");
assert_eq!(Day::Twentieth.as_str_num_ordinal_upper()     , "20TH");
assert_eq!(Day::TwentyFirst.as_str_num_ordinal_upper()   , "21ST");
assert_eq!(Day::TwentySecond.as_str_num_ordinal_upper()  , "22ND");
assert_eq!(Day::TwentyThird.as_str_num_ordinal_upper()   , "23RD");
assert_eq!(Day::TwentyFourth.as_str_num_ordinal_upper()  , "24TH");
assert_eq!(Day::TwentyFifth.as_str_num_ordinal_upper()   , "25TH");
assert_eq!(Day::TwentySixth.as_str_num_ordinal_upper()   , "26TH");
assert_eq!(Day::TwentySeventh.as_str_num_ordinal_upper() , "27TH");
assert_eq!(Day::TwentyEighth.as_str_num_ordinal_upper()  , "28TH");
assert_eq!(Day::TwentyNinth.as_str_num_ordinal_upper()   , "29TH");
assert_eq!(Day::Thirtieth.as_str_num_ordinal_upper()     , "30TH");
assert_eq!(Day::ThirtyFirst.as_str_num_ordinal_upper()   , "31ST");
source

pub const fn as_str_jp(self) -> &'static str

assert_eq!(Day::First.as_str_jp()         , "一日");
assert_eq!(Day::Second.as_str_jp()        , "二日");
assert_eq!(Day::Third.as_str_jp()         , "三日");
assert_eq!(Day::Fourth.as_str_jp()        , "四日");
assert_eq!(Day::Fifth.as_str_jp()         , "五日");
assert_eq!(Day::Sixth.as_str_jp()         , "六日");
assert_eq!(Day::Seventh.as_str_jp()       , "七日");
assert_eq!(Day::Eighth.as_str_jp()        , "八日");
assert_eq!(Day::Ninth.as_str_jp()         , "九日");
assert_eq!(Day::Tenth.as_str_jp()         , "十日");
assert_eq!(Day::Eleventh.as_str_jp()      , "十一日");
assert_eq!(Day::Twelfth.as_str_jp()       , "十二日");
assert_eq!(Day::Thirteenth.as_str_jp()    , "十三日");
assert_eq!(Day::Fourteenth.as_str_jp()    , "十四日");
assert_eq!(Day::Fifteenth.as_str_jp()     , "十五日");
assert_eq!(Day::Sixteenth.as_str_jp()     , "十六日");
assert_eq!(Day::Seventeenth.as_str_jp()   , "十七日");
assert_eq!(Day::Eighteenth.as_str_jp()    , "十八日");
assert_eq!(Day::Nineteenth.as_str_jp()    , "十九日");
assert_eq!(Day::Twentieth.as_str_jp()     , "二十日");
assert_eq!(Day::TwentyFirst.as_str_jp()   , "二十一日");
assert_eq!(Day::TwentySecond.as_str_jp()  , "二十二日");
assert_eq!(Day::TwentyThird.as_str_jp()   , "二十三日");
assert_eq!(Day::TwentyFourth.as_str_jp()  , "二十四日");
assert_eq!(Day::TwentyFifth.as_str_jp()   , "二十五日");
assert_eq!(Day::TwentySixth.as_str_jp()   , "二十六日");
assert_eq!(Day::TwentySeventh.as_str_jp() , "二十七日");
assert_eq!(Day::TwentyEighth.as_str_jp()  , "二十八日");
assert_eq!(Day::TwentyNinth.as_str_jp()   , "二十九日");
assert_eq!(Day::Thirtieth.as_str_jp()     , "三十日");
assert_eq!(Day::ThirtyFirst.as_str_jp()   , "三十一日");
source

pub const fn from_str(s: &str) -> Option<Self>

Create a Day by parsing a &str

Valid input strings are anything returned by

These cases are covered:

  • lowercase
  • UPPERCASE
  • CamelCase

For example:

assert_eq!(Day::from_str("21").unwrap(),          Day::TwentyFirst);
assert_eq!(Day::from_str("21st").unwrap(),        Day::TwentyFirst);
assert_eq!(Day::from_str("21ST").unwrap(),        Day::TwentyFirst);
assert_eq!(Day::from_str("twentyfirst").unwrap(), Day::TwentyFirst);
assert_eq!(Day::from_str("TwentyFirst").unwrap(), Day::TwentyFirst);
assert_eq!(Day::from_str("TWENTYFIRST").unwrap(), Day::TwentyFirst);
Examples
assert_eq!(Day::from_str("1").unwrap(),     Day::First);
assert_eq!(Day::from_str("1st").unwrap(),   Day::First);
assert_eq!(Day::from_str("1ST").unwrap(),   Day::First);
assert_eq!(Day::from_str("first").unwrap(), Day::First);
assert_eq!(Day::from_str("First").unwrap(), Day::First);
assert_eq!(Day::from_str("FIRST").unwrap(), Day::First);

assert_eq!(Day::from_str("2").unwrap(),      Day::Second);
assert_eq!(Day::from_str("2nd").unwrap(),    Day::Second);
assert_eq!(Day::from_str("2ND").unwrap(),    Day::Second);
assert_eq!(Day::from_str("second").unwrap(), Day::Second);
assert_eq!(Day::from_str("Second").unwrap(), Day::Second);
assert_eq!(Day::from_str("SECOND").unwrap(), Day::Second);

assert_eq!(Day::from_str("3").unwrap(),     Day::Third);
assert_eq!(Day::from_str("3rd").unwrap(),   Day::Third);
assert_eq!(Day::from_str("3RD").unwrap(),   Day::Third);
assert_eq!(Day::from_str("third").unwrap(), Day::Third);
assert_eq!(Day::from_str("Third").unwrap(), Day::Third);
assert_eq!(Day::from_str("THIRD").unwrap(), Day::Third);

assert_eq!(Day::from_str("10").unwrap(),    Day::Tenth);
assert_eq!(Day::from_str("10th").unwrap(),  Day::Tenth);
assert_eq!(Day::from_str("10TH").unwrap(),  Day::Tenth);
assert_eq!(Day::from_str("tenth").unwrap(), Day::Tenth);
assert_eq!(Day::from_str("Tenth").unwrap(), Day::Tenth);
assert_eq!(Day::from_str("TENTH").unwrap(), Day::Tenth);

assert_eq!(Day::from_str("31").unwrap(),          Day::ThirtyFirst);
assert_eq!(Day::from_str("31st").unwrap(),        Day::ThirtyFirst);
assert_eq!(Day::from_str("31ST").unwrap(),        Day::ThirtyFirst);
assert_eq!(Day::from_str("thirtyfirst").unwrap(), Day::ThirtyFirst);
assert_eq!(Day::from_str("ThirtyFirst").unwrap(), Day::ThirtyFirst);
assert_eq!(Day::from_str("THIRTYFIRST").unwrap(), Day::ThirtyFirst);
source

pub const fn from_bytes(bytes: &[u8]) -> Option<Self>

Same as Self::from_str but from [&[u8]]

Safety

bytes must be valid UTF-8.

source

pub const fn inner(self) -> u8

assert_eq!(Day::First.inner(), 1);

Trait Implementations§

source§

impl<'__de> BorrowDecode<'__de> for Day

source§

fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
source§

impl Clone for Day

source§

fn clone(&self) -> Day

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Day

source§

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

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

impl Decode for Day

source§

fn decode<__D: Decoder>(decoder: &mut __D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
source§

impl Default for Day

source§

fn default() -> Day

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Day

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Encode for Day

source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
source§

impl Hash for Day

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 Into<i128> for Day

source§

fn into(self) -> i128

Converts this type into the (usually inferred) input type.
source§

impl Into<i16> for Day

source§

fn into(self) -> i16

Converts this type into the (usually inferred) input type.
source§

impl Into<i32> for Day

source§

fn into(self) -> i32

Converts this type into the (usually inferred) input type.
source§

impl Into<i64> for Day

source§

fn into(self) -> i64

Converts this type into the (usually inferred) input type.
source§

impl Into<i8> for Day

source§

fn into(self) -> i8

Converts this type into the (usually inferred) input type.
source§

impl Into<isize> for Day

source§

fn into(self) -> isize

Converts this type into the (usually inferred) input type.
source§

impl Into<u128> for Day

source§

fn into(self) -> u128

Converts this type into the (usually inferred) input type.
source§

impl Into<u16> for Day

source§

fn into(self) -> u16

Converts this type into the (usually inferred) input type.
source§

impl Into<u32> for Day

source§

fn into(self) -> u32

Converts this type into the (usually inferred) input type.
source§

impl Into<u64> for Day

source§

fn into(self) -> u64

Converts this type into the (usually inferred) input type.
source§

impl Into<u8> for Day

source§

fn into(self) -> u8

Converts this type into the (usually inferred) input type.
source§

impl Into<usize> for Day

source§

fn into(self) -> usize

Converts this type into the (usually inferred) input type.
source§

impl Ord for Day

source§

fn cmp(&self, other: &Day) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<i128> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<i16> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<i32> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<i64> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<i8> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<isize> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u128> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u16> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u32> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u64> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<u8> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<usize> for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Day

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Day

source§

fn partial_cmp(&self, other: &Day) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Day

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for Day

source§

impl Eq for Day

source§

impl StructuralEq for Day

source§

impl StructuralPartialEq for Day

Auto Trait Implementations§

§

impl RefUnwindSafe for Day

§

impl Send for Day

§

impl Sync for Day

§

impl Unpin for Day

§

impl UnwindSafe for Day

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

§

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

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,