Enum cal_calc::Holiday

source ·
pub enum Holiday {
    WeekDay(Weekday),
    YearlyDay {
        month: u8,
        day: u8,
        first: Option<i32>,
        last: Option<i32>,
    },
    MovableYearlyDay {
        month: u8,
        day: u8,
        first: Option<i32>,
        last: Option<i32>,
    },
    ModifiedMovableYearlyDay {
        month: u8,
        day: u8,
        first: Option<i32>,
        last: Option<i32>,
    },
    SingularDay(Date),
    EasterOffset {
        offset: i32,
        first: Option<i32>,
        last: Option<i32>,
    },
    MonthWeekday {
        month: u8,
        weekday: Weekday,
        nth: NthWeek,
        first: Option<i32>,
        last: Option<i32>,
    },
}

Variants§

§

WeekDay(Weekday)

Though weekends are no holidays, they need to be specified in the calendar. Weekends are assumed to be non-business days. In most countries, weekends include Saturday (Sat) and Sunday (Sun). Unfortunately, there are a few exceptions.

§

YearlyDay

Fields

§month: u8
§day: u8
§first: Option<i32>
§last: Option<i32>

A holiday that occurs every year on the same day. first and last are the first and last year this day is a holiday (inclusively).

§

MovableYearlyDay

Fields

§month: u8
§day: u8
§first: Option<i32>
§last: Option<i32>

Occurs every year, but is moved to next non-weekend day if it falls on a weekend. Note that Saturday and Sunday here assumed to be weekend days, even if these days are not defined as weekends in this calendar. If the next Monday is already a holiday, the date will be moved to the next available business day. first and last are the first and last year this day is a holiday (inclusively).

§

ModifiedMovableYearlyDay

Fields

§month: u8
§day: u8
§first: Option<i32>
§last: Option<i32>

Occurs every year, but is moved to previous Friday if it falls on Saturday and to the next Monday if it falls on a Sunday. first and last are the first and last year this day is a holiday (inclusively).

§

SingularDay(Date)

A single holiday which is valid only once in time.

§

EasterOffset

Fields

§offset: i32
§first: Option<i32>
§last: Option<i32>

A holiday that is defined in relative days (e.g. -2 for Good Friday) to Easter (Sunday).

§

MonthWeekday

Fields

§month: u8
§weekday: Weekday
§first: Option<i32>
§last: Option<i32>

A holiday that falls on the nth (or last) weekday of a specific month, e.g. the first Monday in May. first and last are the first and last year this day is a holiday (inclusively).

Trait Implementations§

source§

impl Debug for Holiday

source§

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

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

impl<'de> Deserialize<'de> for Holiday

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<Holiday> for Holiday

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Holiday

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Holiday

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,