1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//! Inlined data for [`readable`](https://docs.rs/readable).
//!
//! Do not use this crate directly.
mod year;
mod month;
mod day;
//---------------------------------------------------------------------------------------------------- Inlined `1900-2100`
/// # INVARIANT
/// Input must be [u8; 10].
///
pub const fn inlined(bytes: &[u8]) -> Option<(u16, u8, u8, [u8; 10])> {
let y = match crate::year::year(&bytes) {
Some(y) => y,
_ => return None,
};
let m = match crate::month::month(&bytes) {
Some(m) => m,
_ => return None,
};
let d = match crate::day::day(&bytes) {
Some(m) => m,
_ => return None,
};
// `-` is `45` in UTF-8 encoding.
Some((y.0, m.0, d.0,
[
y.1[0], y.1[1], y.1[2], y.1[3],
45,
m.1[0], m.1[1],
45,
d.1[0], d.1[1],
]
))
}