Enum Era

enum Era

The era corresponding to a particular year.

The BCE era corresponds to years less than or equal to 0, while the CE era corresponds to years greater than 0.

In particular, this crate allows years to be negative and also to be 0, which is contrary to the common practice of excluding the year 0 when writing dates for the Gregorian calendar. Moreover, common practice eschews negative years in favor of labeling a year with an era notation. That is, the year 1 BCE is year 0 in this crate. The year 2 BCE is the year -1 in this crate.

To get the year in its era format, use Date::era_year.

Variants

BCE

The "before common era" era.

This corresponds to all years less than or equal to 0.

This is precisely equivalent to the "BC" or "before Christ" era.

CE

The "common era" era.

This corresponds to all years greater than 0.

This is precisely equivalent to the "AD" or "anno Domini" or "in the year of the Lord" era.

Implementations

impl Clone for Era

fn clone(self: &Self) -> Era

impl Copy for Era

impl Debug for Era

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl Eq for Era

impl Freeze for Era

impl Hash for Era

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl PartialEq for Era

fn eq(self: &Self, other: &Era) -> bool

impl RefUnwindSafe for Era

impl Send for Era

impl StructuralPartialEq for Era

impl Sync for Era

impl Unpin for Era

impl UnwindSafe for Era

impl<T> Any for Era

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Era

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Era

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Era

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Era

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Era

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Era

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Era

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Era

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>