Skip to main content

kundli_rs/
lib.rs

1//! `kundli-rs` computes a kundli from astronomical inputs.
2//!
3//! The most ergonomic entrypoints are [`calculate_kundli`] and the crate-root
4//! re-exported request/config/result types. Use [`calculate_kundli_with_engine`]
5//! when you want to inject a custom [`AstroEngine`] implementation for testing
6//! or alternative data sources.
7//!
8//! # Quick start
9//!
10//! ```no_run
11//! use kundli_rs::{AstroRequest, ChartLayer, ChartSpec, KundliConfig, calculate_kundli};
12//!
13//! let request = AstroRequest::new(2451545.0, 37.5665, 126.9780);
14//!
15//! let config = KundliConfig::from_request(&request).with_charts(&[
16//!     ChartSpec::d1(),
17//!     ChartSpec::d9(),
18//!     ChartSpec::vimshottari_dasha(),
19//! ]);
20//!
21//! let result = calculate_kundli(request, config)?;
22//! let d1 = result
23//!     .chart(ChartSpec::d1())
24//!     .and_then(ChartLayer::as_chart)
25//!     .unwrap();
26//!
27//! println!("Lagna sign: {:?}", d1.lagna.sign);
28//! # Ok::<(), kundli_rs::KundliError>(())
29//! ```
30//!
31//! # API overview
32//!
33//! A typical workflow is:
34//!
35//! 1. Build an [`AstroRequest`].
36//! 2. Choose a [`KundliConfig`].
37//! 3. Call [`calculate_kundli`] or [`calculate_kundli_with_engine`].
38//! 4. Inspect the returned [`KundliResult`].
39//!
40//! [`AstroRequest`] and [`KundliConfig`] both carry zodiac, ayanamsha,
41//! house-system, and node-type settings. Use [`KundliConfig::from_request`]
42//! when you want those duplicated settings to match by construction.
43
44pub mod kundli;
45
46pub use kundli::astro::{
47    AstroBody, AstroBodyPosition, AstroEngine, AstroError, AstroMeta, AstroRequest, AstroResult,
48    Ayanamsha, HouseSystem, NodeType, SwissEphAstroEngine, SwissEphConfig, ZodiacType,
49};
50pub use kundli::calculate::{calculate_kundli, calculate_kundli_with_engine};
51pub use kundli::config::{
52    ChartKind, ChartSpec, HouseMode, KundliConfig, ReferenceKey, SpecialReference,
53};
54pub use kundli::error::{ChartSelectionError, DeriveError, InputConfigMismatchField, KundliError};
55pub use kundli::model::{
56    CalculationMeta, CalculationWarning, ChartLayer, ChartResult, ChartStyle, D1Chart, D9Chart,
57    DashaLord, DashaPeriod, HouseNumber, HouseResult, KundliResult, LagnaResult, Nakshatra,
58    NakshatraPlacement, Pada, PlanetPlacement, ReferenceResult, Sign, VimshottariDasha,
59};