Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Mdf

Month, day of month and year flags: (month << 9) | (day << 4) | flags M_MMMD_DDDD_LFFF

The whole bits except for the least 3 bits are referred as Mdl (month, day of month, and leap year flag), which is an index to the MDL_TO_OL lookup table.

The conversion between the packed calendar date (Mdf) and the ordinal date (NaiveDate) is based on the moderately-sized lookup table (~1.5KB) and the packed representation is chosen for efficient lookup.

The methods of Mdf validate their inputs as late as possible. Dates that can’t exist, like February 30, can still be represented. This allows the validation to be combined with the final table lookup, which is good for performance.

Fully qualified path: chrono::internals::Mdf

[derive(Clone, Copy, PartialEq, Drop, Debug)]
pub struct Mdf { /* private fields */ }