bdays
Provides functions to perform business days calculation between dates, given a Holiday Calendar.
A Business Day is defined as a weekday that is not a holiday.
To check if a date is a holiday, you must provide an implementation of the HolidayCalendar trait.
This crate is a port of BusinessDays.jl to the Rust programming language.
Provided Holiday Calendars
This crate provides a set of built-in holiday calendars in the bdays::calendars submodule.
-
bdays::calendars::WeekendsOnly: accounts only weekends -
bdays::calendars::brazil::BRSettlement: Brazilian banking holidays -
bdays::calendars::brazil::BrazilExchange: B3 Exchange holidays (http://www.b3.com.br) -
bdays::calendars::us::USSettlement: United States federal holidays
Usage
Add these dependencies to your Cargo.toml file.
[]
= "0.1"
= "0.4"
The following example shows the basic functions from this package.
use NaiveDate;
use HolidayCalendar;
HolidayCalendarCache
As a motivation, this example might take some time to finish.
use NaiveDate;
use HolidayCalendar;
let cal = BRSettlement;
let d0 = from_ymd;
let d1 = from_ymd;
for _i in 0..30
You can use HolidayCalendarCache to perform fast business days calculation
for a given range of dates.
use NaiveDate;
use HolidayCalendar;
let cal = new;
let d0 = from_ymd;
let d1 = from_ymd;
for _i in 0..30