#![no_std]
#[cfg(test)]
#[macro_use]
extern crate std;
#[macro_export]
macro_rules! year {
($year:ident) => {
const {
$crate::Year::try_from_str(core::stringify!($year))
.expect(concat!("Invalid SAC13 year: ", stringify!($year)))
}
};
}
#[macro_export]
macro_rules! date_greg {
($year:literal - $month:literal - $day:literal) => {
const {
#[allow(clippy::zero_prefixed_literal)]
let y = $year;
#[allow(clippy::zero_prefixed_literal)]
let m = $month;
#[allow(clippy::zero_prefixed_literal)]
let d = $day;
$crate::GregorianDate::from_ymd(y, m, d)
.expect("The given input was not a valid Gregorian Calendar date")
}
};
}
#[macro_export]
macro_rules! date {
($year:ident - $month:literal - $day:literal) => {
const {
let y = $crate::year!($year);
#[allow(clippy::zero_prefixed_literal)]
let m = $month;
#[allow(clippy::zero_prefixed_literal)]
let d = $day;
let m = $crate::Month::new(m).expect(concat!(
"Month must be a value from 1 - 13. Given: ",
$month
));
$crate::Date::from_ymd(y, m, d).expect("The given input was not a valid SAC13 date")
}
};
}
macro_rules! ok {
($opt:expr) => {
match $opt {
::core::option::Option::None => return ::core::option::Option::None,
::core::option::Option::Some(x) => x,
}
};
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
#[allow(missing_docs)]
pub enum YearType {
Common,
Leap,
}
pub mod prelude;
pub mod day_counts {
pub use crate::date_sac13::raw_date::YearOrdinal;
pub use crate::scalars::{CycleEpochDay, JulianDay, Sac13Day, UnixDay};
}
pub use date_gregorian::GregorianDate;
pub use date_sac13::Date;
pub use month::Month;
pub use parse::*;
pub use sac_or_greg::SacOrGreg;
pub use scalars::Year;
pub use traits::CalendarDate;
pub(crate) mod parse;
mod date_gregorian;
mod date_sac13;
mod iterhelp;
mod month;
mod sac_or_greg;
mod scalars;
mod traits;
#[cfg(test)]
mod tests;
#[cfg(any(test, doctest))]
pub mod readme_test {
#![doc = include_str!("../README.md")]
}