calendrical_calculations::chinese_based

Trait ChineseBased

Source
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 a RataDie 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§

Source

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.

Source

const EPOCH_ISO: i32

The ISO year that corresponds to year 1

Source

const DEBUG_NAME: &'static str

The name of the calendar for debugging.

Required Methods§

Source

fn location(fixed: RataDie) -> Location

Given a fixed date, return the location 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.

Provided Methods§

Source

fn extended_from_iso(iso_year: i32) -> i32

Given an ISO year, return the extended year

Source

fn iso_from_extended(extended_year: i32) -> i32

Given an extended year, return the ISO year

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.

Implementors§

Source§

impl ChineseBased for Chinese

Source§

const EPOCH: RataDie = CHINESE_EPOCH

Source§

const EPOCH_ISO: i32 = -2_636i32

Source§

const DEBUG_NAME: &'static str = "chinese"

Source§

impl ChineseBased for Dangi

Source§

const EPOCH: RataDie = KOREAN_EPOCH

Source§

const EPOCH_ISO: i32 = -2_332i32

Source§

const DEBUG_NAME: &'static str = "dangi"