pub struct BusinessCalendar { /* private fields */ }Expand description
Which days are not business days: weekends, plus whatever holidays the caller supplies.
No market calendars ship with this crate. A bundled holiday list is a maintenance promise — holidays are announced, moved and added per market and year — and a stale list is worse than no list, because it looks authoritative. Callers that need real holidays pass them in.
Implementations§
Source§impl BusinessCalendar
impl BusinessCalendar
Sourcepub fn weekends_only() -> Self
pub fn weekends_only() -> Self
Saturdays and Sundays only.
Sourcepub fn with_holidays(holidays: impl IntoIterator<Item = Date>) -> Self
pub fn with_holidays(holidays: impl IntoIterator<Item = Date>) -> Self
Saturdays, Sundays and the given dates.
pub fn is_business_day(&self, date: Date) -> bool
Sourcepub fn adjust(&self, date: Date, convention: BusinessDayConvention) -> Date
pub fn adjust(&self, date: Date, convention: BusinessDayConvention) -> Date
Applies convention to date. An BusinessDayConvention::Unadjusted date is returned
unchanged even if it is a holiday.
Trait Implementations§
Source§impl Clone for BusinessCalendar
impl Clone for BusinessCalendar
Source§fn clone(&self) -> BusinessCalendar
fn clone(&self) -> BusinessCalendar
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BusinessCalendar
impl Debug for BusinessCalendar
Source§impl Default for BusinessCalendar
impl Default for BusinessCalendar
Source§fn default() -> BusinessCalendar
fn default() -> BusinessCalendar
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BusinessCalendar
impl<'de> Deserialize<'de> for BusinessCalendar
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for BusinessCalendar
Source§impl PartialEq for BusinessCalendar
impl PartialEq for BusinessCalendar
Source§impl Serialize for BusinessCalendar
impl Serialize for BusinessCalendar
impl StructuralPartialEq for BusinessCalendar
Auto Trait Implementations§
impl Freeze for BusinessCalendar
impl RefUnwindSafe for BusinessCalendar
impl Send for BusinessCalendar
impl Sync for BusinessCalendar
impl Unpin for BusinessCalendar
impl UnsafeUnpin for BusinessCalendar
impl UnwindSafe for BusinessCalendar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more