pub struct Calendar { /* private fields */ }
Expand description
Calendar for arbitrary complex holiday rules
Implementations§
source§impl Calendar
impl Calendar
sourcepub fn calc_calendar(
holiday_rules: &[Holiday],
start: i32,
end: i32
) -> Result<Calendar, CalendarError>
pub fn calc_calendar( holiday_rules: &[Holiday], start: i32, end: i32 ) -> Result<Calendar, CalendarError>
Calculate all holidays and recognize weekend days for a given range of years
from start
to end
(inclusively). The calculation is performed on the basis
of a vector of holiday rules.
sourcepub fn next_bday(&self, date: Date) -> Result<Date, CalendarError>
pub fn next_bday(&self, date: Date) -> Result<Date, CalendarError>
Calculate the next business day
sourcepub fn prev_bday(&self, date: Date) -> Result<Date, CalendarError>
pub fn prev_bday(&self, date: Date) -> Result<Date, CalendarError>
Calculate the previous business day
sourcepub fn is_weekend(&self, day: Date) -> bool
pub fn is_weekend(&self, day: Date) -> bool
Returns true if the date falls on a weekend
sourcepub fn is_holiday(&self, date: Date) -> bool
pub fn is_holiday(&self, date: Date) -> bool
Returns true if the specified day is a bank holiday
sourcepub fn is_business_day(&self, date: Date) -> bool
pub fn is_business_day(&self, date: Date) -> bool
Returns true if the specified day is a business day