Struct TimeNanosecond
pub struct TimeNanosecond { /* private fields */ }
Represents a single point in a civil day, to nanosecond precision.
Implementations
impl TimeNanosecond
const fn new(nanosecond: i64) -> Result<TimeNanosecond, RangeError>Creates a new civil time from a given nanosecond value.
The value must correspond to the number of nanoseconds elapsed since the start of a civil day. It cannot exceed the length of a civil day (in nanoseconds).
const fn nanosecond(self) -> i64Returns the nanosecond value.
The value returned is guaranteed to be in the range specified by
CivilDayNanosecond.const fn overflowing_add(self, nanoseconds: i64) -> Result<(TimeNanosecond, i64), RangeError>Adds the given number of nanoseconds to this civil time and returns the resulting civil time with any overflowing amount in units of civil days.
This returns an error when integer overflow occurs. For example, when
secondsisi64::MAXand this civil time is any time other than midnight.Note that the number of days returned may exceed the range supported by
UnixEpochDay. Moreover, the number of days returned may be negative. This occurs only whennanosecondsis negative enough to result in the time wrapping around at0.const fn to_time(&self) -> TimeConverts this second representation of a civil time into the components of a civil time.
The subsecond component on the
Timereturned is always0.
Trait Implementations
impl Clone for TimeNanosecond
fn clone(&self) -> TimeNanosecond
impl Copy for TimeNanosecond
impl Debug for TimeNanosecond
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for TimeNanosecond
impl Ord for TimeNanosecond
fn cmp(&self, other: &TimeNanosecond) -> Ordering
impl PartialEq for TimeNanosecond
fn eq(&self, other: &TimeNanosecond) -> bool
impl PartialOrd for TimeNanosecond
fn partial_cmp(&self, other: &TimeNanosecond) -> Option<Ordering>
impl StructuralPartialEq for TimeNanosecond
Auto Trait Implementations
impl Freeze for TimeNanosecond
impl RefUnwindSafe for TimeNanosecond
impl Send for TimeNanosecond
impl Sync for TimeNanosecond
impl Unpin for TimeNanosecond
impl UnsafeUnpin for TimeNanosecond
impl UnwindSafe for TimeNanosecond
Blanket Implementations
impl<T> Any for TimeNanosecond
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for TimeNanosecond
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for TimeNanosecond
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for TimeNanosecond
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for TimeNanosecond
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for TimeNanosecond
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for TimeNanosecond
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 TimeNanosecond
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 TimeNanosecond
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>