pub trait ChineseBased {
const EPOCH: RataDie;
const DEBUG_NAME: &'static str;
// Required method
fn utc_offset(fixed: RataDie) -> f64;
}
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§
Sourcefn utc_offset(fixed: RataDie) -> f64
fn utc_offset(fixed: RataDie) -> f64
Given a fixed date, return the UTC offset used for observations of the new moon in order to calculate the beginning of months. For multiple Chinese-based lunar calendars, this has changed over the years, and can cause differences in calendar date.
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.