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