pub struct ModifiedJulianDate<Representation, Period: ?Sized = SecondsPerDay> { /* private fields */ }Expand description
The Modified Julian Day (MJD) representation of any given date.
Implementations§
Source§impl<Representation> ModifiedJulianDate<Representation, SecondsPerDay>
impl<Representation> ModifiedJulianDate<Representation, SecondsPerDay>
Source§impl<Representation, Period: ?Sized> ModifiedJulianDate<Representation, Period>
impl<Representation, Period: ?Sized> ModifiedJulianDate<Representation, Period>
Sourcepub const fn from_time_since_epoch(
time_since_epoch: Duration<Representation, Period>,
) -> Self
pub const fn from_time_since_epoch( time_since_epoch: Duration<Representation, Period>, ) -> Self
Constructs a new MJD directly from some duration since the MJD epoch, November 17 1858.
Sourcepub const fn time_since_epoch(&self) -> Duration<Representation, Period>where
Representation: Copy,
pub const fn time_since_epoch(&self) -> Duration<Representation, Period>where
Representation: Copy,
Returns the time since the MJD epoch of this day.
Sourcepub fn from_date(date: Date<Representation>) -> Selfwhere
Representation: Copy + From<i32> + Add<Representation, Output = Representation> + ConvertUnit<SecondsPerDay, Period>,
pub fn from_date(date: Date<Representation>) -> Selfwhere
Representation: Copy + From<i32> + Add<Representation, Output = Representation> + ConvertUnit<SecondsPerDay, Period>,
Constructs a modified Julian date from some given calendar date.
Sourcepub fn into_date(&self) -> Date<Representation>where
Representation: Copy + From<i32> + Sub<Representation, Output = Representation> + ConvertUnit<Period, SecondsPerDay>,
pub fn into_date(&self) -> Date<Representation>where
Representation: Copy + From<i32> + Sub<Representation, Output = Representation> + ConvertUnit<Period, SecondsPerDay>,
Converts this modified Julian date into the equivalent “universal” calendar date.
Sourcepub fn cast<Target>(self) -> ModifiedJulianDate<Target, Period>where
Representation: Into<Target>,
pub fn cast<Target>(self) -> ModifiedJulianDate<Target, Period>where
Representation: Into<Target>,
Infallibly converts towards a different representation.
Sourcepub fn try_cast<Target>(
self,
) -> Result<ModifiedJulianDate<Target, Period>, <Representation as TryIntoExact<Target>>::Error>where
Representation: TryIntoExact<Target>,
pub fn try_cast<Target>(
self,
) -> Result<ModifiedJulianDate<Target, Period>, <Representation as TryIntoExact<Target>>::Error>where
Representation: TryIntoExact<Target>,
Converts towards a different representation. If the underlying representation cannot store
the result of this cast, returns None.
Source§impl ModifiedJulianDate<i32>
impl ModifiedJulianDate<i32>
Sourcepub fn from_historic_date(
year: i32,
month: Month,
day: u8,
) -> Result<Self, InvalidHistoricDate>
pub fn from_historic_date( year: i32, month: Month, day: u8, ) -> Result<Self, InvalidHistoricDate>
Creates a Date based on a year-month-day date in the historic calendar.
Sourcepub fn from_gregorian_date(
year: i32,
month: Month,
day: u8,
) -> Result<Self, InvalidGregorianDate>
pub fn from_gregorian_date( year: i32, month: Month, day: u8, ) -> Result<Self, InvalidGregorianDate>
Creates a Date based on a year-month-day date in the proleptic Gregorian calendar.
Sourcepub fn from_julian_date(
year: i32,
month: Month,
day: u8,
) -> Result<Self, InvalidJulianDate>
pub fn from_julian_date( year: i32, month: Month, day: u8, ) -> Result<Self, InvalidJulianDate>
Creates a Date based on a year-month-day date in the proleptic Julian calendar.
Trait Implementations§
Source§impl<Representation: Clone, Period: Clone + ?Sized> Clone for ModifiedJulianDate<Representation, Period>
impl<Representation: Clone, Period: Clone + ?Sized> Clone for ModifiedJulianDate<Representation, Period>
Source§fn clone(&self) -> ModifiedJulianDate<Representation, Period>
fn clone(&self) -> ModifiedJulianDate<Representation, Period>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Representation: Debug, Period: Debug + ?Sized> Debug for ModifiedJulianDate<Representation, Period>
impl<Representation: Debug, Period: Debug + ?Sized> Debug for ModifiedJulianDate<Representation, Period>
Source§impl<Representation, Period: ?Sized> From<Date<Representation>> for ModifiedJulianDate<Representation, Period>where
Representation: Copy + From<i32> + Add<Representation, Output = Representation> + ConvertUnit<SecondsPerDay, Period>,
impl<Representation, Period: ?Sized> From<Date<Representation>> for ModifiedJulianDate<Representation, Period>where
Representation: Copy + From<i32> + Add<Representation, Output = Representation> + ConvertUnit<SecondsPerDay, Period>,
Source§impl<Representation, Period: ?Sized> From<ModifiedJulianDate<Representation, Period>> for Date<Representation>where
Representation: Copy + From<i32> + Sub<Representation, Output = Representation> + ConvertUnit<Period, SecondsPerDay>,
impl<Representation, Period: ?Sized> From<ModifiedJulianDate<Representation, Period>> for Date<Representation>where
Representation: Copy + From<i32> + Sub<Representation, Output = Representation> + ConvertUnit<Period, SecondsPerDay>,
Source§fn from(value: ModifiedJulianDate<Representation, Period>) -> Self
fn from(value: ModifiedJulianDate<Representation, Period>) -> Self
Source§impl<Representation: Hash, Period: Hash + ?Sized> Hash for ModifiedJulianDate<Representation, Period>
impl<Representation: Hash, Period: Hash + ?Sized> Hash for ModifiedJulianDate<Representation, Period>
Source§impl<Representation: Ord, Period: Ord + ?Sized> Ord for ModifiedJulianDate<Representation, Period>
impl<Representation: Ord, Period: Ord + ?Sized> Ord for ModifiedJulianDate<Representation, Period>
Source§fn cmp(&self, other: &ModifiedJulianDate<Representation, Period>) -> Ordering
fn cmp(&self, other: &ModifiedJulianDate<Representation, Period>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<Representation: PartialEq, Period: PartialEq + ?Sized> PartialEq for ModifiedJulianDate<Representation, Period>
impl<Representation: PartialEq, Period: PartialEq + ?Sized> PartialEq for ModifiedJulianDate<Representation, Period>
Source§fn eq(&self, other: &ModifiedJulianDate<Representation, Period>) -> bool
fn eq(&self, other: &ModifiedJulianDate<Representation, Period>) -> bool
self and other values to be equal, and is used by ==.Source§impl<Representation: PartialOrd, Period: PartialOrd + ?Sized> PartialOrd for ModifiedJulianDate<Representation, Period>
impl<Representation: PartialOrd, Period: PartialOrd + ?Sized> PartialOrd for ModifiedJulianDate<Representation, Period>
impl<Representation: Copy, Period: Copy + ?Sized> Copy for ModifiedJulianDate<Representation, Period>
impl<Representation: Eq, Period: Eq + ?Sized> Eq for ModifiedJulianDate<Representation, Period>
impl<Representation, Period: ?Sized> StructuralPartialEq for ModifiedJulianDate<Representation, Period>
Auto Trait Implementations§
impl<Representation, Period> Freeze for ModifiedJulianDate<Representation, Period>
impl<Representation, Period> RefUnwindSafe for ModifiedJulianDate<Representation, Period>
impl<Representation, Period> Send for ModifiedJulianDate<Representation, Period>
impl<Representation, Period> Sync for ModifiedJulianDate<Representation, Period>
impl<Representation, Period> Unpin for ModifiedJulianDate<Representation, Period>
impl<Representation, Period> UnwindSafe for ModifiedJulianDate<Representation, Period>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> TryIntoExact<T> for Uwhere
T: TryFromExact<U>,
impl<T, U> TryIntoExact<T> for Uwhere
T: TryFromExact<U>,
type Error = <T as TryFromExact<U>>::Error
Source§fn try_into_exact(self) -> Result<T, <U as TryIntoExact<T>>::Error>
fn try_into_exact(self) -> Result<T, <U as TryIntoExact<T>>::Error>
self into type T. If this conversion may succeed without loss of
information, returns Ok(_) with the converted value. If any information may be lost (even
if it is only floating point rounding), returns None.