3 releases
0.1.2 | Sep 14, 2024 |
---|---|
0.1.1 | Sep 14, 2024 |
0.1.0 | Sep 14, 2024 |
#21 in #international
40 downloads per month
140KB
2.5K
SLoC
public_holidays
Description
public_holidays
is a Rust library that provides functionality to work with public holidays for various countries. It allows users to retrieve, validate, and manipulate public holiday information easily and efficiently.
Setup & Installation
To use public_holidays
in your Rust project, add the following to your Cargo.toml
file:
[dependencies]
public_holidays = "*"
Then, run cargo build
to fetch and compile the library.
or simply run cargo add public_holidays
from your terminal.
API Usage
Here's an overview of the main functions and structs exposed in lib.rs
:
use public_holidays::{get_holiday_by_date, get_holiday_by_name};
let holidays = get_holiday_by_name("Christmas").unwrap();
let holiday_date = get_holiday_by_date("2024-12-25").unwrap();
println!("{:?}", holidays);
println!("{:?}", holiday_date);
Supported Countries
The library currently supports public holidays for the following countries:
- United States (US)
- United Kingdom (UK)
- Canada (CA)
- Australia (AU)
- Germany (DE)
To add support for more countries, please contribute to the project!
Error Handling
All functions that can fail return a Result
type. Make sure to handle potential errors appropriately in your code.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~4–6MB
~107K SLoC