[][src]Struct abi_stable::std_types::RDuration

#[repr(C)]pub struct RDuration { /* fields omitted */ }

Ffi-safe equivalent of std::time::Duration .

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_millis(31416);
assert_eq!( dur.as_secs(), 31 );
assert_eq!( dur.as_nanos(), 31_416_000_000 );
 

Implementations

impl RDuration[src]

pub const fn new(seconds: u64, subsec_nanos: u32) -> Self[src]

Constructs this RDuration from seconds and the nanoseconds inside a second .

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::new(1,456_000_000);
assert_eq!( dur.as_millis(), 1_456 );
assert_eq!( dur.as_micros(), 1_456_000 );
 

pub const fn from_secs(secs: u64) -> RDuration[src]

Creates an RDuration of secs seconds.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_secs(14);
assert_eq!( dur.as_millis(), 14_000 );
assert_eq!( dur.as_micros(), 14_000_000 );
 

pub const fn from_millis(milli: u64) -> RDuration[src]

Creates an RDuration of milli milliseconds.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_millis(628);
assert_eq!( dur.as_micros(), 628_000 );
assert_eq!( dur.as_nanos(), 628_000_000 );
 

pub const fn from_micros(micro: u64) -> RDuration[src]

Creates an RDuration of micro microseconds.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_micros(1024);
assert_eq!( dur.as_millis(), 1 );
assert_eq!( dur.as_nanos(), 1024_000 );
 

pub const fn from_nanos(nano: u64) -> RDuration[src]

Creates an RDuration of nano nanoseconds.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_nanos(128_256_512);
assert_eq!( dur.as_millis(), 128 );
assert_eq!( dur.as_micros(), 128_256 );
 

pub const fn subsec_nanos(&self) -> u32[src]

The amount of fractional nanoseconds (total_nanoseconds % 1_000_000_000) of this RDuration.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_nanos(64_128_256_512);
assert_eq!( dur.subsec_nanos(), 128_256_512 );
 

pub const fn seconds(&self) -> u64[src]

The amount of seconds of this RDuration.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_nanos(64_128_256_512);
assert_eq!( dur.seconds(), 64 );
 

pub const fn as_secs(&self) -> u64[src]

The amount of seconds of this RDuration.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_nanos(64_128_256_512);
assert_eq!( dur.as_secs(), 64 );
 

pub const fn as_millis(&self) -> u128[src]

The amount of milliseconds of this RDuration.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_nanos(64_128_256_512);
assert_eq!( dur.as_millis(), 64_128 );
 

pub const fn as_micros(&self) -> u128[src]

The amount of microseconds of this RDuration.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_nanos(64_128_256_512);
assert_eq!( dur.as_micros(), 64_128_256 );
 

pub const fn as_nanos(&self) -> u128[src]

The amount of nanoseconds of this RDuration.

Example

use abi_stable::std_types::RDuration;
 
let dur=RDuration::from_micros(256);
assert_eq!( dur.as_nanos(), 256_000 );
 

Trait Implementations

impl Clone for RDuration[src]

impl Copy for RDuration[src]

impl Debug for RDuration[src]

impl<'de> Deserialize<'de> for RDuration[src]

impl Eq for RDuration[src]

impl From<Duration> for RDuration[src]

impl GetStaticEquivalent_ for RDuration[src]

type StaticEquivalent = _static_RDuration

impl Hash for RDuration[src]

impl Into<Duration> for RDuration[src]

impl IntoReprRust for RDuration[src]

type ReprRust = Duration

The #[repr(Rust)] equivalent.

impl Ord for RDuration[src]

impl PartialEq<RDuration> for RDuration[src]

impl PartialOrd<RDuration> for RDuration[src]

impl Serialize for RDuration[src]

impl StableAbi for RDuration[src]

type IsNonZeroType = False

Whether this type has a single invalid bit-pattern. Read more

impl StructuralEq for RDuration[src]

impl StructuralPartialEq for RDuration[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> BorrowOwned<'a> for T where
    T: 'a + Clone
[src]

type ROwned = T

The owned type, stored in RCow::Owned

type RBorrowed = &'a T

The borrowed type, stored in RCow::Borrowed

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> GetWithMetadata for T[src]

type ForSelf = WithMetadata_<T, T>

This is always WithMetadata_<Self, Self>

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SelfOps for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<This> TransmuteElement for This where
    This: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The error type returned when the conversion fails.

impl<T> TypeIdentity for T where
    T: ?Sized
[src]

type Type = T

The same type as Self. Read more

impl<This> ValidTag_Bounds for This where
    This: Debug + Clone + PartialEq<This>, 
[src]