Crates.io | public_holidays |
lib.rs | public_holidays |
version | 0.1.2 |
source | src |
created_at | 2024-09-14 06:45:42.108162 |
updated_at | 2024-09-14 06:57:28.751462 |
description | A Rust library for working with public holidays in various countries |
homepage | |
repository | https://github.com/learnwithsobhit/public_holidays |
max_upload_size | |
id | 1374519 |
size | 141,504 |
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.
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.
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);
The library currently supports public holidays for the following countries:
To add support for more countries, please contribute to the project!
All functions that can fail return a Result
type. Make sure to handle potential errors appropriately in your code.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.