pub struct Holiday<S: ToString> { /* private fields */ }
Expand description
An annually repeating calendar date. Can be either a fixed date (e.g., April 1) or an nth weekday of the month (e.g., 4th Thursday in November)
Implementations§
source§impl<S: ToString> Holiday<S>
impl<S: ToString> Holiday<S>
sourcepub fn new_fixed<M: Into<Month>>(name: S, month: M, day: u32) -> Self
pub fn new_fixed<M: Into<Month>>(name: S, month: M, day: u32) -> Self
Creates a new fixed date holiday
sourcepub fn new_nth<N: Into<NthWeekday>, M: Into<Month>>(
name: S,
nth: N,
weekday: Weekday,
month: M
) -> Self
pub fn new_nth<N: Into<NthWeekday>, M: Into<Month>>( name: S, nth: N, weekday: Weekday, month: M ) -> Self
Creates a new nth weekday of the month Holiday
sourcepub fn iter(&self) -> HolidayIter<'_, Self> ⓘ
pub fn iter(&self) -> HolidayIter<'_, Self> ⓘ
Returns an iterator over all the occurrences of a given Holiday starting at the earliest representable date.
Trait Implementations§
source§impl<S: ToString> BeforeAfterDate for Holiday<S>
impl<S: ToString> BeforeAfterDate for Holiday<S>
source§fn after_today(&self) -> NaiveDate
fn after_today(&self) -> NaiveDate
The next occurrence including today (successor)
source§fn before_today(&self) -> NaiveDate
fn before_today(&self) -> NaiveDate
The previous occurrence excluding today (predecessor)
source§fn first_date(&self) -> NaiveDate
fn first_date(&self) -> NaiveDate
The first representable occurrence of the date
source§impl<'h, S: ToString> IntoIterator for &'h Holiday<S>
impl<'h, S: ToString> IntoIterator for &'h Holiday<S>
source§impl<S: ToString> Ord for Holiday<S>
impl<S: ToString> Ord for Holiday<S>
source§impl<S: ToString> PartialEq<NaiveDate> for Holiday<S>
impl<S: ToString> PartialEq<NaiveDate> for Holiday<S>
source§impl<S: ToString> PartialEq<NthWeekdayOfMonth> for Holiday<S>
impl<S: ToString> PartialEq<NthWeekdayOfMonth> for Holiday<S>
source§fn eq(&self, nth: &NthWeekdayOfMonth) -> bool
fn eq(&self, nth: &NthWeekdayOfMonth) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<S: ToString> PartialEq for Holiday<S>
impl<S: ToString> PartialEq for Holiday<S>
source§impl<S: ToString> PartialOrd for Holiday<S>
impl<S: ToString> PartialOrd for Holiday<S>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<S: Copy + ToString> Copy for Holiday<S>
impl<S: ToString> Eq for Holiday<S>
Auto Trait Implementations§
impl<S> Freeze for Holiday<S>where
S: Freeze,
impl<S> RefUnwindSafe for Holiday<S>where
S: RefUnwindSafe,
impl<S> Send for Holiday<S>where
S: Send,
impl<S> Sync for Holiday<S>where
S: Sync,
impl<S> Unpin for Holiday<S>where
S: Unpin,
impl<S> UnwindSafe for Holiday<S>where
S: UnwindSafe,
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