pub struct FiscalCalendar {
pub calendar_type: FiscalCalendarType,
pub name: String,
}Expand description
Fiscal calendar definition.
Fields§
§calendar_type: FiscalCalendarTypeType of fiscal calendar.
name: StringName of the fiscal calendar (e.g., “US Federal”, “Retail 445”).
Implementations§
Source§impl FiscalCalendar
impl FiscalCalendar
Sourcepub fn calendar_year() -> Self
pub fn calendar_year() -> Self
Creates a standard calendar year fiscal calendar.
Sourcepub fn custom_year_start(start_month: u8, start_day: u8) -> Self
pub fn custom_year_start(start_month: u8, start_day: u8) -> Self
Creates a fiscal calendar with custom year start.
Sourcepub fn four_four_five(config: FourFourFiveConfig) -> Self
pub fn four_four_five(config: FourFourFiveConfig) -> Self
Creates a 4-4-5 retail calendar.
Sourcepub fn thirteen_period(config: ThirteenPeriodConfig) -> Self
pub fn thirteen_period(config: ThirteenPeriodConfig) -> Self
Creates a 13-period calendar.
Sourcepub fn fiscal_year(&self, date: NaiveDate) -> i32
pub fn fiscal_year(&self, date: NaiveDate) -> i32
Returns the fiscal year for a given date.
Sourcepub fn fiscal_period(&self, date: NaiveDate) -> u8
pub fn fiscal_period(&self, date: NaiveDate) -> u8
Returns the fiscal period number for a given date.
Trait Implementations§
Source§impl Clone for FiscalCalendar
impl Clone for FiscalCalendar
Source§fn clone(&self) -> FiscalCalendar
fn clone(&self) -> FiscalCalendar
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 FiscalCalendar
impl Debug for FiscalCalendar
Source§impl Default for FiscalCalendar
impl Default for FiscalCalendar
Source§impl<'de> Deserialize<'de> for FiscalCalendar
impl<'de> Deserialize<'de> for FiscalCalendar
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
Source§impl PartialEq for FiscalCalendar
impl PartialEq for FiscalCalendar
Source§fn eq(&self, other: &FiscalCalendar) -> bool
fn eq(&self, other: &FiscalCalendar) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for FiscalCalendar
impl Serialize for FiscalCalendar
impl Eq for FiscalCalendar
impl StructuralPartialEq for FiscalCalendar
Auto Trait Implementations§
impl Freeze for FiscalCalendar
impl RefUnwindSafe for FiscalCalendar
impl Send for FiscalCalendar
impl Sync for FiscalCalendar
impl Unpin for FiscalCalendar
impl UnsafeUnpin for FiscalCalendar
impl UnwindSafe for FiscalCalendar
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.