Struct rkyv::time::ArchivedDuration

source ·
pub struct ArchivedDuration { /* private fields */ }
Expand description

An archived Duration.

Implementations§

source§

impl ArchivedDuration

source

pub const fn as_secs(&self) -> u64

Returns the number of whole seconds contained by this ArchivedDuration.

The returned value does not include the fractional (nanosecond) part of the duration, which can be obtained using subsec_nanos.

source

pub const fn subsec_millis(&self) -> u32

Returns the fractional part of this ArchivedDuration, in whole milliseconds.

This method does not return the length of the duration when represented by milliseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one thousand).

source

pub const fn subsec_micros(&self) -> u32

Returns the fractional part of this ArchivedDuration, in whole microseconds.

This method does not return the length of the duration when represented by microseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one million).

source

pub const fn subsec_nanos(&self) -> u32

Returns the fractional part of this Duration, in nanoseconds.

This method does not return the length of the duration when represented by nanoseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one billion).

source

pub const fn as_millis(&self) -> u128

Returns the total number of whole milliseconds contained by this ArchivedDuration.

source

pub const fn as_micros(&self) -> u128

Returns the total number of whole microseconds contained by this ArchivedDuration.

source

pub const fn as_nanos(&self) -> u128

Returns the total number of nanoseconds contained by this ArchivedDuration.

source

pub fn as_secs_f64(&self) -> f64

Returns the number of seconds contained by this ArchivedDuration as f64.

The returned value does include the fractional (nanosecond) part of the duration.

source

pub fn as_secs_f32(&self) -> f32

Returns the number of seconds contained by this ArchivedDuration as f32.

The returned value does include the fractional (nanosecond) part of the duration.

source

pub unsafe fn emplace(secs: u64, nanos: u32, out: *mut ArchivedDuration)

Constructs an archived duration at the given position.

Safety

out must point to memory suitable for holding an ArchivedDuration.

Trait Implementations§

source§

impl Clone for ArchivedDuration

source§

fn clone(&self) -> ArchivedDuration

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ArchivedDuration

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for ArchivedDuration

source§

fn default() -> ArchivedDuration

Returns the “default value” for a type. Read more
source§

impl<D: Fallible + ?Sized> Deserialize<Duration, D> for ArchivedDuration

source§

fn deserialize(&self, _: &mut D) -> Result<Duration, D::Error>

Deserializes using the given deserializer
source§

impl<D: Fallible + ?Sized> DeserializeWith<ArchivedDuration, SystemTime, D> for UnixTimestamp

source§

fn deserialize_with( field: &ArchivedDuration, _: &mut D ) -> Result<SystemTime, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl From<ArchivedDuration> for Duration

source§

fn from(duration: ArchivedDuration) -> Self

Converts to this type from the input type.
source§

impl Hash for ArchivedDuration

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for ArchivedDuration

source§

fn cmp(&self, other: &ArchivedDuration) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<ArchivedDuration> for Duration

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Duration> for ArchivedDuration

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for ArchivedDuration

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ArchivedDuration

source§

fn partial_cmp(&self, other: &ArchivedDuration) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for ArchivedDuration

source§

impl Eq for ArchivedDuration

source§

impl StructuralEq for ArchivedDuration

source§

impl StructuralPartialEq for ArchivedDuration

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CallHasher for T
where T: Hash + ?Sized,

source§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.