zmanim_calculator/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2#![warn(missing_docs)]
3//! Calculate zmanim (Jewish halachic times) using KosherJava-style concepts and naming.
4//!
5//! Typical usage:
6//! - Build a [`Location`](crate::types::location::Location).
7//! - Create a [`ZmanimCalculator`](crate::calculator::ZmanimCalculator) with a date and
8//! [`CalculatorConfig`](crate::types::config::CalculatorConfig).
9//! - Compute times using ready-made definitions from [`presets`]
10//! (for example, `presets::SUNRISE` and `presets::SUNSET`).
11//!
12//! [`ZmanimCalculator::calculate`](crate::calculator::ZmanimCalculator::calculate) returns
13//! `Result<DateTime<Utc>, ZmanimError>`.
14//! In edge cases (for example high latitudes on specific dates), calculations may return an error.
15//!
16//! `calculate` takes `&mut self` so repeated calculations can reuse intermediate state.
17//! If Rust borrow rules are awkward for your call pattern, clone the calculator and use each
18//! clone independently.
19#[cfg(test)]
20mod java_tests;
21#[cfg(test)]
22mod tests;
23mod types {
24 /// Configuration types for zmanim calculations.
25 pub mod config;
26 /// Error types for zmanim calculations.
27 pub mod error;
28 /// Location types for zmanim calculations.
29 pub mod location;
30}
31// Calculation logic for zmanim.
32pub mod calculator;
33mod duration_helper;
34/// Predefined zmanim calculations built from reusable primitives.
35pub mod presets;
36/// Low-level zman formulas used to build higher-level presets.
37pub mod primitive_zman;
38
39/// Re-export the most commonly used types and traits.
40pub mod prelude {
41 pub use crate::calculator::ZmanimCalculator;
42 pub use crate::presets::ZmanPreset;
43 pub use crate::primitive_zman::ZmanPrimitive;
44 pub use crate::types::config::CalculatorConfig;
45 pub use crate::types::error::ZmanimError;
46 pub use crate::types::location::Location;
47}