pub trait ChineseBased {
const EPOCH: RataDie;
const EPOCH_ISO: i32;
const DEBUG_NAME: &'static str;
// Required method
fn location(fixed: RataDie) -> Location;
// Provided methods
fn extended_from_iso(iso_year: i32) -> i32 { ... }
fn iso_from_extended(extended_year: i32) -> i32 { ... }
}
Expand description
The trait ChineseBased is used by Chinese-based calendars to perform computations shared by such calendar. To do so, calendars should:
- Implement
fn location
by providing a location at which observations of the moon are recorded, which may change over time (the zone is important, long, lat, and elevation are not relevant for these calculations) - Define
const EPOCH
as aRataDie
marking the start date of the era of the Calendar for internal use, which may not accurately reflect how years or eras are marked traditionally or seen by end-users
Required Associated Constants§
sourceconst EPOCH: RataDie
const EPOCH: RataDie
The RataDie of the beginning of the epoch used for internal computation; this may not reflect traditional methods of year-tracking or eras, since Chinese-based calendars may not track years ordinally in the same way many western calendars do.
sourceconst DEBUG_NAME: &'static str
const DEBUG_NAME: &'static str
The name of the calendar for debugging.
Required Methods§
Provided Methods§
sourcefn extended_from_iso(iso_year: i32) -> i32
fn extended_from_iso(iso_year: i32) -> i32
Given an ISO year, return the extended year
sourcefn iso_from_extended(extended_year: i32) -> i32
fn iso_from_extended(extended_year: i32) -> i32
Given an extended year, return the ISO year
Object Safety§
This trait is not object safe.