1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! # holidays_jp
//!
//! A Rust library and CLI tool for determining Japanese national holidays.
//!
//! This library provides functionality to check if a specific date is a Japanese national holiday
//! and to list holidays within a date range. The holiday data is based on the official CSV file
//! provided by the Cabinet Office of Japan.
//!
//! ## Features
//!
//! - Check if a specific date is a Japanese national holiday
//! - List all holidays within a date range
//! - Support for multiple date formats (YYYYMMDD, YYYY-MM-DD, YYYY/MM/DD, YYYY年MM月DD日, etc.)
//! - Automatic caching of holiday data with configurable update strategies
//! - Async/await support using tokio
//!
//! ## Library Usage
//!
//! Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! holidays_jp = "0.3"
//! tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
//! ```
//!
//! ## Examples
//!
//! ### Check if a specific date is a holiday
//!
//! ```rust,no_run
//! use holidays_jp::{HolidayService, Config};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let config = Config::default();
//! let mut service = HolidayService::new(config);
//! service.initialize().await?;
//!
//! let (is_holiday, holiday_name) = service.get_holiday("2023-01-01")?;
//! if is_holiday {
//! println!("2023-01-01 is a holiday: {}", holiday_name.unwrap());
//! } else {
//! println!("2023-01-01 is not a holiday");
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ### List holidays in a date range
//!
//! ```rust,no_run
//! use holidays_jp::{HolidayService, Config};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let config = Config::default();
//! let mut service = HolidayService::new(config);
//! service.initialize().await?;
//!
//! let holidays = service.get_holidays_in_range("2023-01-01", "2023-12-31")?;
//! for (date, name) in holidays {
//! println!("{}: {}", date, name);
//! }
//!
//! Ok(())
//! }
//! ```
// Re-export main types for easier use
pub use Config;
pub use HolidayService;