pub trait Rules:
Clone
+ Debug
+ UnstableSealed {
// Required method
fn year_data(&self, related_iso: i32) -> EastAsianTraditionalYearData;
// Provided methods
fn ecma_reference_year(
&self,
_month_code: (u8, bool),
_day: u8,
) -> Result<i32, EcmaReferenceYearError> { ... }
fn debug_name(&self) -> &'static str { ... }
fn calendar_algorithm(&self) -> Option<CalendarAlgorithm> { ... }
}Expand description
The rules for the EastAsianTraditional calendar.
The calendar depends on both astronomical calculations and local time. The rules for how to perform these calculations, as well as how local time is determined differ between countries and have changed over time.
This crate currently provides Rules for China and Korea.
It is still possible to implement this trait in userland (since UnstableSealed is public),
do not do so unless you are prepared for things to occasionally break.
Required Methods§
Sourcefn year_data(&self, related_iso: i32) -> EastAsianTraditionalYearData
fn year_data(&self, related_iso: i32) -> EastAsianTraditionalYearData
Returns data about the given year.
Provided Methods§
Sourcefn ecma_reference_year(
&self,
_month_code: (u8, bool),
_day: u8,
) -> Result<i32, EcmaReferenceYearError>
fn ecma_reference_year( &self, _month_code: (u8, bool), _day: u8, ) -> Result<i32, EcmaReferenceYearError>
Returns an ECMA reference year that contains the given month-day combination.
If the day is out of range, it will return a year that contains the given month and the maximum day possible for that month. See the spec for the precise algorithm used.
This API only matters when using MissingFieldsStrategy::Ecma to compute
a date without providing a year in [Date::try_from_fields()]. The default impl
will just error, and custom calendars who do not care about ECMA/Temporal
reference years do not need to override this.
Sourcefn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
The debug name for the calendar defined by these Rules.
Sourcefn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
fn calendar_algorithm(&self) -> Option<CalendarAlgorithm>
The BCP-47 CalendarAlgorithm for the calendar defined by these Rules, if defined.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.