HolidayAPI Rust client
📆⚙️ HolidayAPI client wrapper for Rust projects.
| Service | Status |
|---|---|
| crates.io |
Pure Rust bindings to the Holiday API.
Dependencies and support
holiday_api is intended to work on all tier 1 supported Rust systems:
- macOS
- Linux
- Windows
Minimum Compiler Version
holiday_api requires rustc 1.75 or higher (edition 2021, async/await).
Getting Started
Add the following to your Cargo.toml:
[]
= "1.0.0"
= { = "1", = ["full"] }
Then in your main.rs:
use HolidayAPIClient;
async
Available methods
All methods are async and must be .awaited.
| Method | Description |
|---|---|
search_holidays(year, country) |
Returns holidays for a given year and country code |
search_countries() |
Returns a list of all supported countries |
search_languages() |
Returns a list of all supported languages |
workday(country, start, days) |
Returns the workday date after N working days from a start date |
workdays(country, start, end) |
Returns the number of working days between two dates |
Environment variable
The API key can be loaded from a .env file using dotenv:
HOLIDAYAPI_APIKEY=your_api_key_here
use dotenv;
use env;
dotenv.ok;
let api_key = var.unwrap;
let client = new;
License
Licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).