Struct DateTime
pub struct DateTime { /* private fields */ }
The representation for a civil datetime used by the TZif implementation.
We don't use civil::DateTime here because we specifically
do not need to represent fractional seconds. This lets us easily represent
what we need in 8 bytes.
Moreover, we pack the fields into a single i64 to make comparisons
extremely cheap. This is especially useful since we do a binary search on
civil datetimes when determining the instant that corresponds to a civil
datetime.
Implementations
impl DateTime
const MIN: DateTime = _;The minimum civil datetime value.
const MAX: DateTime = _;The maximum civil datetime value.
const fn new(dt: DateTime) -> DateTimeCreates a new TZif civil datetime from jiff-core's standard civil datetime type.
Note that this completely ignores any fractional second component on the provided datetime.
const fn year(self) -> i16Returns the year component of this civil datetime.
const fn month(self) -> i8Returns the month component of this civil datetime.
const fn day(self) -> i8Returns the day component of this civil datetime.
const fn hour(self) -> i8Returns the hour component of this civil datetime.
const fn minute(self) -> i8Returns the minute component of this civil datetime.
const fn second(self) -> i8Returns the second component of this civil datetime.
Trait Implementations
impl Clone for DateTime
fn clone(&self) -> DateTime
impl Copy for DateTime
impl Debug for DateTime
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for DateTime
impl From<DateTime> for DateTime
fn from(dt: DateTime) -> DateTime
impl Hash for DateTime
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for DateTime
fn cmp(&self, other: &DateTime) -> Ordering
impl PartialEq for DateTime
fn eq(&self, other: &DateTime) -> bool
impl PartialOrd for DateTime
fn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
impl StructuralPartialEq for DateTime
Auto Trait Implementations
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnsafeUnpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations
impl<T> Any for DateTime
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for DateTime
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for DateTime
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for DateTime
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for DateTime
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for DateTime
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for DateTime
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for DateTime
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for DateTime
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>