rs_klc/lib.rs
1#![doc = include_str!("../README.md")]
2
3//! ## Usage
4//! Add this to your `Cargo.toml`:
5//! ```toml
6//! [dependencies]
7//! rs-klc = "0.1" // Check crates.io for the latest version
8//! ```
9//!
10//! ## Examples
11//! ```rust
12//! use rs_klc::{LunarSolarConverter, DayOfWeek};
13//!
14//! let mut converter = LunarSolarConverter::new();
15//!
16//! // Set a solar date (e.g., 2022-07-10)
17//! if converter.set_solar_date(2022, 7, 10) {
18//! println!("Solar: {}", converter.get_solar_iso_format());
19//! println!("Lunar: {}", converter.get_lunar_iso_format());
20//! println!("Gapja: {}", converter.get_gapja_string());
21//!
22//! // Get day of week
23//! if let Some(dow) = LunarSolarConverter::get_day_of_week(2022, 7, 10) {
24//! println!("Day of Week: {:?}", dow);
25//! }
26//!
27//! // Check solar leap year
28//! let is_solar_leap = LunarSolarConverter::is_solar_leap_year(2022);
29//! println!("Solar Year 2022 Leap: {}", is_solar_leap);
30//!
31//! // Check lunar intercalary month for the corresponding lunar year
32//! let lunar_year = converter.lunar_year();
33//! if let Some(intercalary_month) = LunarSolarConverter::get_lunar_intercalary_month(lunar_year) {
34//! println!("Lunar Year {} has intercalary month: {}", lunar_year, intercalary_month);
35//! } else {
36//! println!("Lunar Year {} has no intercalary month.", lunar_year);
37//! }
38//! } else {
39//! println!("Invalid solar date");
40//! }
41//! ```
42
43// Declare the module where the implementation resides
44pub mod klc;
45
46// Re-export the main struct and enum for easier access
47pub use klc::{DayOfWeek, LunarSolarConverter};