Struct bdays::HolidayCalendarCache

source ·
pub struct HolidayCalendarCache<T: Datelike + Copy + PartialOrd> { /* private fields */ }
Expand description

Caches business days calculation for a given holiday calendar and a given range of dates. Implements the HolidayCalendar trait.

Implementations§

source§

impl<T: Datelike + Copy + PartialOrd + Display> HolidayCalendarCache<T>

source

pub fn new<H: HolidayCalendar<T>>( calendar: H, dt_min: T, dt_max: T ) -> HolidayCalendarCache<T>

Creates HolidayCalendarCache that caches business days calculation in the range of dates from dt_min to dt_max.

Trait Implementations§

source§

impl<T: Datelike + Copy + PartialOrd + Display> HolidayCalendar<T> for HolidayCalendarCache<T>

source§

fn is_holiday(&self, date: T) -> bool

Returns true if date is a holiday.
source§

fn is_bday(&self, date: T) -> bool

Returns true if date is a Business Day. A Business Day is defined as a weekday that is not a holiday.
source§

fn bdays(&self, d0: T, d1: T) -> i32

Returns the number of business days between d0 and d1.
source§

fn to_bday(&self, date: T, adjust_next: bool) -> T

Adjusts date to the last/next business day if it’s not a business day.
source§

fn advance_bdays(&self, date: T, bdays_count: i32) -> T

Advances bdays_count number of business days from date.

Auto Trait Implementations§

§

impl<T> Freeze for HolidayCalendarCache<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for HolidayCalendarCache<T>
where T: RefUnwindSafe,

§

impl<T> Send for HolidayCalendarCache<T>
where T: Send,

§

impl<T> Sync for HolidayCalendarCache<T>
where T: Sync,

§

impl<T> Unpin for HolidayCalendarCache<T>
where T: Unpin,

§

impl<T> UnwindSafe for HolidayCalendarCache<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.