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

Object Safety§

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"