Enum Era

pub 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.

Trait Implementations

impl Clone for Era

fn clone(&self) -> Self

impl Copy for Era

impl Debug for Era

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

impl Eq for Era

impl Hash for Era

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

impl PartialEq for Era

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

impl StructuralPartialEq for Era

Auto Trait Implementations

impl Freeze for Era

impl RefUnwindSafe for Era

impl Send for Era

impl Sync for Era

impl Unpin for Era

impl UnsafeUnpin for Era

impl UnwindSafe for Era

Blanket Implementations

impl<T> Any for Era where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Era where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Era where T: ?Sized,

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

impl<T> CloneToUninit for Era where T: Clone,

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

impl<T> From<T> for Era

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Era where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Era where U: From<T>,

fn into(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<U> for Era where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Era where U: TryFrom<T>,

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