calendrical_calculations/lib.rs
1// This file is part of ICU4X.
2//
3// The contents of this file implement algorithms from Calendrical Calculations
4// by Reingold & Dershowitz, Cambridge University Press, 4th edition (2018),
5// which have been released as Lisp code at <https://github.com/EdReingold/calendar-code2/>
6// under the Apache-2.0 license. Accordingly, this file is released under
7// the Apache License, Version 2.0 which can be found at the calendrical_calculations
8// package root or at http://www.apache.org/licenses/LICENSE-2.0.
9
10// https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations
11#![cfg_attr(not(any(test, doc)), no_std)]
12#![cfg_attr(
13 not(test),
14 deny(
15 clippy::indexing_slicing,
16 clippy::unwrap_used,
17 clippy::expect_used,
18 clippy::panic,
19 )
20)]
21#![warn(missing_docs)]
22
23//! Calendrical calculations
24//!
25//! This crate implements algorithms from
26//! Calendrical Calculations by Reingold & Dershowitz, Cambridge University Press, 4th edition (2018)
27//! as needed by [ICU4X](https://github.com/unicode-org/icu4x).
28//!
29//! Most of these algorithms can be found as lisp code in the book or
30//! [on GithHub](https://github.com/EdReingold/calendar-code2/blob/main/calendar.l).
31//!
32//! The primary purpose of this crate is use by ICU4X, however if non-ICU4X users need this we are happy
33//! to add more structure to this crate as needed.
34mod astronomy;
35/// Chinese-like lunar calendars (Chinese, Dangi)
36pub mod chinese_based;
37/// The Coptic calendar
38pub mod coptic;
39/// Error handling
40pub mod error;
41/// The Ethiopian calendar
42pub mod ethiopian;
43/// The Gregorian calendar
44pub mod gregorian;
45/// The Hebrew calendar
46pub mod hebrew;
47pub mod hebrew_keviyah;
48/// Additional math helpers
49pub mod helpers;
50/// Various islamic lunar calendars
51pub mod islamic;
52/// Aliases for the Gregorian calendar.
53///
54/// This is *not* the ISO week calendar as described in the book.
55#[deprecated(since = "0.2.3", note = "use `gregorian`")]
56pub mod iso {
57 pub use crate::gregorian::day_before_year;
58 pub use crate::gregorian::days_before_month;
59 pub use crate::gregorian::easter;
60 pub use crate::gregorian::fixed_from_gregorian as const_fixed_from_iso;
61 pub use crate::gregorian::fixed_from_gregorian as fixed_from_iso;
62 pub use crate::gregorian::gregorian_from_fixed as iso_from_fixed;
63 pub use crate::gregorian::is_leap_year;
64 pub use crate::gregorian::year_day;
65 pub use crate::gregorian::year_from_fixed as iso_year_from_fixed;
66}
67/// The Julian calendar
68pub mod julian;
69/// The Persian calendar
70pub mod persian;
71/// Representation of Rata Die (R.D.) dates, which are
72/// represented as the number of days since ISO date 0001-01-01.
73pub mod rata_die;