//! Cotton Days' rules: what a day is (`assets/design/days/DECISIONS.md`).//! PURE: the phone core and the Worker ask the same functions, and none of//! them reads a clock or a table. The core (cotton-ffi `phone::days`) reads//! the rows and hands them here as [`layout::Item`]s; what comes back is what//! a phone draws.//!//! - [`layout`]: the rows of each day in the decided order, their marks,//! times and quiet suffixes, and the folded runs of empty days.//! - [`when`]: a day and a time read out of one typed or dictated line.//! - [`marks`]: the marks catalogue and its offline word lookup.//! - [`rhythm`]: a repeating item's rhythm in words, and search's folding.//! - [`words`]: every word Days says, per language, as data.pubmod layout;pubmod marks;pubmod rhythm;pubmod when;pubmod words;/// The day number (days since 1970-01-01) of a `YYYY-MM-DD` key, or `None`.pubfn day_of_key(key: &str) -> Option<i64> {let bytes = key.as_bytes();if key.len() != 10 || bytes[4] != b'-' || bytes[7] != b'-' {returnNone; }let year: i64 = key.get(0..4)?.parse().ok()?;let month: i64 = key.get(5..7)?.parse().ok()?;let day: i64 = key.get(8..10)?.parse().ok()?;if !(1..=12).contains(&month) || day < 1 || day > crate::zoned_clock::days_in_month(year, month) {returnNone; }Some(crate::zoned_clock::day_number(year, month, day))}/// Monday = 0 … Sunday = 6, the order the word lists keep.pubfn weekday_monday_first(day: i64) -> usize { ((crate::zoned_clock::weekday_of_day_number(day) + 6) % 7) as usize}#[cfg(test)]#[path = "days_tests.rs"]mod tests;