pub struct CalendarSystem { /* private fields */ }Expand description
A resolved calendar system, and the ICU data to compute in it.
Implementations§
Source§impl CalendarSystem
impl CalendarSystem
Sourcepub fn is_gregorian(&self) -> bool
pub fn is_gregorian(&self) -> bool
Whether this is the plain Gregorian calendar, where every conversion is
the identity and the arithmetic in crate::calendar already applies.
Sourcepub fn from_gregorian(&self, date: Date) -> (i32, u32, u32)
pub fn from_gregorian(&self, date: Date) -> (i32, u32, u32)
The (year, month, day) one Gregorian date has in this system.
Sourcepub fn to_gregorian(&self, year: i32, month: u32, day: u32) -> Option<Date>
pub fn to_gregorian(&self, year: i32, month: u32, day: u32) -> Option<Date>
The Gregorian date one (year, month, day) in this system names.
None when the triple does not exist – a 31st in a 30-day month, or a
month this system’s year does not have.
Sourcepub fn days_in_month(&self, year: i32, month: u32) -> u32
pub fn days_in_month(&self, year: i32, month: u32) -> u32
Days in one month of this system.
Sourcepub fn months_in_year(&self, year: i32) -> u32
pub fn months_in_year(&self, year: i32) -> u32
Months in one year of this system. Lunisolar years gain a leap month.
Sourcepub fn first_weekday(&self, year: i32, month: u32) -> usize
pub fn first_weekday(&self, year: i32, month: u32) -> usize
The weekday the 1st of this month falls on, Monday as 0 – the same
convention as first_weekday_pub.
Sourcepub fn add_months(&self, year: i32, month: u32, delta: i32) -> (i32, u32)
pub fn add_months(&self, year: i32, month: u32, delta: i32) -> (i32, u32)
The (year, month) delta months away in this system.
Years do not all hold twelve months – a lunisolar year gains a leap month – so this steps one month at a time rather than dividing, and asks the system how long each year it crosses actually is.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CalendarSystem
impl RefUnwindSafe for CalendarSystem
impl Send for CalendarSystem
impl Sync for CalendarSystem
impl Unpin for CalendarSystem
impl UnsafeUnpin for CalendarSystem
impl UnwindSafe for CalendarSystem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more