Skip to main content

GermanState

Enum GermanState 

Source
pub enum GermanState {
Show 17 variants BW, BY, BE, BB, HB, HH, HE, MV, NI, NW, RP, SL, SN, ST, SH, TH, ANY,
}
Expand description

Enum for all German states, plus a variant for holidays effective in any state. These implement HolidayCalendar

Variants§

§

BW

Baden-Württemberg

§

BY

Bayern

§

BE

Berlin

§

BB

Brandenburg

§

HB

Bremen

§

HH

Hamburg

§

HE

Hessen

§

MV

Mecklenburg-Vorpommern

§

NI

Niedersachsen

§

NW

Nordrhein-Westfalen

§

RP

Rheinland-Pfalz

§

SL

Saarland

§

SN

Sachsen

§

ST

Sachsen-Anhalt

§

SH

Schleswig-Holstein

§

TH

Thüringen

§

ANY

Checks for holidays in any state

Implementations§

Source§

impl GermanState

Source

pub fn num_holidays(&self, year: i32) -> u32

Returns the number of holidays in the given state and year

§Arguments
  • year - The year for which to count the number of holidays
§Example
use bdays::calendars::de::GermanState;
assert_eq!(GermanState::NI.num_holidays(2023), 10);

Trait Implementations§

Source§

impl Clone for GermanState

Source§

fn clone(&self) -> Self

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 Copy for GermanState

Source§

impl Debug for GermanState

Source§

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

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

impl<T: Datelike + Copy + PartialOrd> HolidayCalendar<T> for GermanState

This implementation doesn’t return any holidays before 1990.

Before that the current Germany was separated into the “German Democratic Republic” and the “Federal Republic of Germany” which both had somewhat different holidays. Since this class is called “Germany” it doesn’t really make sense to include the days from the two former countries.

Note that Germany doesn’t have rules for holidays that happen on a Sunday. Those holidays are still holiday days but there is no additional day to make up for the “lost” day.

Also note that German holidays are partly declared by each state there are some weired edge cases:

  • Assumption Day / Mariä Himmelfahrt is only a holiday in Bavaria (BY) if your municipality is mostly catholic which in term depends on census data. Since we don’t have this data but most municipalities in Bavaria are mostly catholic, we count that as holiday for whole Bavaria.
  • There is an Augsburg Peace Festival / Augsburger Friedensfest which only exists in the Bavarian town Augsburg. This is excluded for Bavaria.
  • Maundy Thursday / Gründonnerstag (Thursday before easter) is not a holiday but pupils in Baden Württemberg (BW) don’t have to go to school. It is excluded from our list.
  • Corpus Christi / Fronleichnam is a holiday in certain, explicitly defined municipalities in Saxony (SN) and Thuringia (TH). We exclude it from both provinces.
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 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.
Source§

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

Returns the number of business days between d0 and d1.

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.