[][src]Struct tendermint::Timeout

pub struct Timeout(_);

Timeout durations

Methods from Deref<Target = Duration>

pub const SECOND: Duration[src]

pub const MILLISECOND: Duration[src]

pub const MICROSECOND: Duration[src]

pub const NANOSECOND: Duration[src]

pub const fn as_secs(&self) -> u641.3.0[src]

Returns the number of whole seconds contained by this Duration.

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

Examples

use std::time::Duration;

let duration = Duration::new(5, 730023852);
assert_eq!(duration.as_secs(), 5);

To determine the total number of seconds represented by the Duration, use as_secs in combination with subsec_nanos:

use std::time::Duration;

let duration = Duration::new(5, 730023852);

assert_eq!(5.730023852,
           duration.as_secs() as f64
           + duration.subsec_nanos() as f64 * 1e-9);

pub const fn subsec_millis(&self) -> u321.27.0[src]

Returns the fractional part of this Duration, 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).

Examples

use std::time::Duration;

let duration = Duration::from_millis(5432);
assert_eq!(duration.as_secs(), 5);
assert_eq!(duration.subsec_millis(), 432);

pub const fn subsec_micros(&self) -> u321.27.0[src]

Returns the fractional part of this Duration, 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).

Examples

use std::time::Duration;

let duration = Duration::from_micros(1_234_567);
assert_eq!(duration.as_secs(), 1);
assert_eq!(duration.subsec_micros(), 234_567);

pub const fn subsec_nanos(&self) -> u321.3.0[src]

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).

Examples

use std::time::Duration;

let duration = Duration::from_millis(5010);
assert_eq!(duration.as_secs(), 5);
assert_eq!(duration.subsec_nanos(), 10_000_000);

pub const fn as_millis(&self) -> u1281.33.0[src]

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

Examples

use std::time::Duration;

let duration = Duration::new(5, 730023852);
assert_eq!(duration.as_millis(), 5730);

pub const fn as_micros(&self) -> u1281.33.0[src]

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

Examples

use std::time::Duration;

let duration = Duration::new(5, 730023852);
assert_eq!(duration.as_micros(), 5730023);

pub const fn as_nanos(&self) -> u1281.33.0[src]

Returns the total number of nanoseconds contained by this Duration.

Examples

use std::time::Duration;

let duration = Duration::new(5, 730023852);
assert_eq!(duration.as_nanos(), 5730023852);

pub fn as_secs_f64(&self) -> f641.38.0[src]

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

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

Examples

use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
assert_eq!(dur.as_secs_f64(), 2.7);

pub fn as_secs_f32(&self) -> f321.38.0[src]

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

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

Examples

use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
assert_eq!(dur.as_secs_f32(), 2.7);

Trait Implementations

impl From<Duration> for Timeout[src]

impl From<Timeout> for Duration[src]

impl Clone for Timeout[src]

impl Copy for Timeout[src]

impl Deref for Timeout[src]

type Target = Duration

The resulting type after dereferencing.

impl Debug for Timeout[src]

impl Display for Timeout[src]

impl FromStr for Timeout[src]

type Err = Error

The associated error which can be returned from parsing.

impl Serialize for Timeout[src]

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

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>[src]

Parse Timeout from string ending in s or ms

Auto Trait Implementations

impl Send for Timeout

impl Sync for Timeout

impl Unpin for Timeout

impl UnwindSafe for Timeout

impl RefUnwindSafe for Timeout

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type 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 type returned in the event of a conversion error.

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self