public_holidays

Crates.iopublic_holidays
lib.rspublic_holidays
version0.1.2
sourcesrc
created_at2024-09-14 06:45:42.108162
updated_at2024-09-14 06:57:28.751462
descriptionA Rust library for working with public holidays in various countries
homepage
repositoryhttps://github.com/learnwithsobhit/public_holidays
max_upload_size
id1374519
size141,504
(learnwithsobhit)

documentation

README

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.

Commit count: 0

cargo fmt