pub struct RataDie(i64);Expand description
The Rata Die, or R.D.: number of days since January 1, 1 CE.
The primary definition of this type is in the calendrical_calculations crate.
See: https://en.wikipedia.org/wiki/Rata_Die
Typically, one should obtain RataDies from other calendrical code, rather than constructing them from integers.
The valid range for direct construction is deliberately not documented as it may change.
Tuple Fields§
§0: i64Implementations§
Source§impl RataDie
impl RataDie
Sourcepub const fn new(fixed_date: i64) -> Self
pub const fn new(fixed_date: i64) -> Self
Create a RataDie
Typically, one should obtain RataDies from other calendrical code, rather than
constructing them from integers. The valid range for direct construction is
deliberately not documented as it may change.
Sourcepub const fn to_i64_date(self) -> i64
pub const fn to_i64_date(self) -> i64
Convert this to an i64 value representing the RataDie
Sourcepub(crate) const fn to_f64_date(self) -> f64
pub(crate) const fn to_f64_date(self) -> f64
Convert this to an f64 value representing the RataDie
Sourcepub const fn since(self, rhs: Self) -> i64
pub const fn since(self, rhs: Self) -> i64
Calculate the number of days between two RataDie in a const-friendly way
use calendrical_calculations::julian::fixed_from_julian;
assert_eq!(
fixed_from_julian(1930, 2, 2).since(fixed_from_julian(1930, 1, 1)),
32
);Sourcepub const fn until(self, rhs: Self) -> i64
pub const fn until(self, rhs: Self) -> i64
Calculate the number of days between two RataDie in a const-friendly way
use calendrical_calculations::julian::fixed_from_julian;
assert_eq!(
fixed_from_julian(1930, 1, 1).until(fixed_from_julian(1930, 2, 2)),
32
);Trait Implementations§
Source§impl AddAssign<i64> for RataDie
impl AddAssign<i64> for RataDie
Source§fn add_assign(&mut self, rhs: i64)
fn add_assign(&mut self, rhs: i64)
+= operation. Read moreSource§impl Ord for RataDie
impl Ord for RataDie
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RataDie
impl PartialOrd for RataDie
Source§impl SubAssign<i64> for RataDie
impl SubAssign<i64> for RataDie
Source§fn sub_assign(&mut self, rhs: i64)
fn sub_assign(&mut self, rhs: i64)
-= operation. Read more