Skip to main content

npdatetime/
lib.rs

1//! # NPDateTime
2//!
3//! High-performance Nepali (Bikram Sambat) datetime library featuring both
4//! lightning-fast lookup-based conversions and high-precision astronomical calculations.
5//!
6//! ## Key Features
7//! - **Hybrid Approach**: Use embedded lookup tables for instant results or full astronomical theories (VSOP87, ELP-2000) for future-proof accuracy.
8//! - **Modular Design**: Easily swap between fast civil calendar logic and precise astronomical events.
9//! - **Cross-Language**: Architected for bindings in Python, JavaScript, Java, and PHP.
10//! - **Performance**: Core logic is written in Rust for maximum speed and memory safety.
11//! - **No-std Support**: Core components are designed to run on embedded systems.
12//!
13//! ## Feature Flags
14//! - `lookup-tables` (default): Enables CSV-backed pre-calculated calendar data (1975-2100 BS).
15//! - `astronomical`: Enables full solar and lunar position calculations for any date range.
16//! - `std`: Enables standard library features including `Chrono` integration.
17//! - `wasm`: Enables WASM bindings for web usage.
18//!
19
20pub mod core;
21#[cfg(feature = "lookup-tables")]
22pub mod lookup;
23
24#[cfg(feature = "astronomical")]
25pub mod astronomical;
26
27pub use core::date::NepaliDate;
28pub use core::error::{NpdatetimeError, Result};
29
30/// Prelude for common imports
31pub mod prelude {
32    pub use crate::core::date::NepaliDate;
33    pub use crate::core::error::{NpdatetimeError, Result};
34
35    #[cfg(feature = "astronomical")]
36    pub use crate::astronomical::{AstronomicalCalendar, SankrantiFinder, TithiCalculator};
37}
38
39/// Library version
40pub const VERSION: &str = env!("CARGO_PKG_VERSION");