Skip to main content

Calendar

Struct Calendar 

Source
pub struct Calendar { /* private fields */ }
Expand description

Which days count as working days.

Implementations§

Source§

impl Calendar

Source

pub fn wbci() -> Calendar

Monday to Friday without the nationwide public holidays — the default, and the reading of „bundeseinheitliche Arbeitstage“ that WBCI 2.0 §12.6 and S/PRI 4.4 §11.3 share.

Source

pub fn mon_fri() -> Calendar

Monday to Friday, holidays included: the literal reading of A1 §2.5.

Source

pub fn werktage() -> Calendar

Werktage: Monday to Saturday without the nationwide public holidays (AH4S/PRI 2.9.5 §3.4 „10 WT“, S/PRI 4.4 §5.1.1 „nächster Werktag (Mo–Sa)“).

Source

pub const fn counts_saturday(&self) -> bool

Whether Saturday counts (the Calendar::werktage reading).

Source

pub fn with_closed(self, day: Date) -> Calendar

Adds a closed day, e.g. a regional holiday that matters to a party.

Source

pub fn closed(&self, day: Date) -> Option<Closed>

Why day is not a working day, or None if it is one.

Source

pub fn is_working_day(&self, day: Date) -> bool

Whether day is a working day.

Source

pub fn add_working_days(&self, day: Date, n: u32) -> Date

The n-th working day after day (A1 §2.5 „X+n AT“); day itself is not counted.

Source

pub fn sub_working_days(&self, day: Date, n: u32) -> Date

The n-th working day before day (A1 §2.5 „X−n AT“).

Source

pub fn walk( &self, start: Date, n: u32, step: i8, ) -> (Date, Vec<Date>, Vec<(Date, Closed)>)

Walks n working days in step direction (positive: forwards), recording the days counted and skipped. Returns the last day reached.

Trait Implementations§

Source§

impl Clone for Calendar

Source§

fn clone(&self) -> Calendar

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Calendar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Calendar

Source§

fn default() -> Calendar

Returns the “default value” for a type. Read more
Source§

impl Eq for Calendar

Source§

impl PartialEq for Calendar

Source§

fn eq(&self, other: &Calendar) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Calendar

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.