pub trait IslamicBasedMarker {
    const EPOCH: RataDie;
    const DEBUG_NAME: &'static str;
    const HAS_353_DAY_YEARS: bool;

    // Required methods
    fn fixed_from_islamic(year: i32, month: u8, day: u8) -> RataDie;
    fn islamic_from_fixed(date: RataDie) -> (i32, u8, u8);

    // Provided methods
    fn mean_synodic_ny(extended_year: i32) -> RataDie { ... }
    fn approximate_islamic_from_fixed(date: RataDie) -> i32 { ... }
    fn month_lengths_for_year(extended_year: i32, ny: RataDie) -> [bool; 12] { ... }
}
Expand description

Common abstraction over islamic-style calendars

Required Associated Constants§

source

const EPOCH: RataDie

The epoch of the calendar. Different calendars use a different epoch (Thu or Fri) due to disagreement on the exact date of Mohammed’s migration to Mecca.

source

const DEBUG_NAME: &'static str

The name of the calendar for debugging.

source

const HAS_353_DAY_YEARS: bool

Whether this calendar is known to have 353-day years. This is probably a bug; see https://github.com/unicode-org/icu4x/issues/4930

Required Methods§

source

fn fixed_from_islamic(year: i32, month: u8, day: u8) -> RataDie

Convert an islamic date in this calendar to a R.D.

source

fn islamic_from_fixed(date: RataDie) -> (i32, u8, u8)

Convert an R.D. To an islamic date in this calendar

Provided Methods§

source

fn mean_synodic_ny(extended_year: i32) -> RataDie

Given the extended year, calculate the approximate new year using the mean synodic month

source

fn approximate_islamic_from_fixed(date: RataDie) -> i32

Given an iso date, calculate the approximate islamic year it corresponds to (for quick cache lookup)

source

fn month_lengths_for_year(extended_year: i32, ny: RataDie) -> [bool; 12]

Given an extended year, calculate whether each month is 29 or 30 days long

Object Safety§

This trait is not object safe.

Implementors§

source§

impl IslamicBasedMarker for CivilIslamicMarker

source§

const EPOCH: RataDie = FIXED_ISLAMIC_EPOCH_FRIDAY

source§

const DEBUG_NAME: &'static str = "CivilIslamic"

source§

const HAS_353_DAY_YEARS: bool = false

source§

impl IslamicBasedMarker for ObservationalIslamicMarker

source§

const EPOCH: RataDie = FIXED_ISLAMIC_EPOCH_FRIDAY

source§

const DEBUG_NAME: &'static str = "ObservationalIslamic"

source§

const HAS_353_DAY_YEARS: bool = true

source§

impl IslamicBasedMarker for SaudiIslamicMarker

source§

const EPOCH: RataDie = FIXED_ISLAMIC_EPOCH_FRIDAY

source§

const DEBUG_NAME: &'static str = "SaudiIslamic"

source§

const HAS_353_DAY_YEARS: bool = true

source§

impl IslamicBasedMarker for TabularIslamicMarker

source§

const EPOCH: RataDie = FIXED_ISLAMIC_EPOCH_THURSDAY

source§

const DEBUG_NAME: &'static str = "TabularIslamic"

source§

const HAS_353_DAY_YEARS: bool = false