[][src]Struct dw1000::time::Duration

#[repr(C)]pub struct Duration(_);

A duration between two instants in DW1000 system time

Internally uses the same 40-bit timestamps that the DW1000 uses.


impl Duration[src]

pub fn new(value: u64) -> Option<Self>[src]

Creates a new instance of Duration

The given value must fit in a 40-bit timestamp, so: 0 <= value <= 2^40 - 1

Returns Some(...), if value is within the valid range, None if it isn't.


use dw1000::time::{

let valid_duration   = Duration::new(TIME_MAX);
let invalid_duration = Duration::new(TIME_MAX + 1);


pub fn from_nanos(nanos: u32) -> Self[src]

Creates an instance of Duration from a number of nanoseconds

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

Returns the raw 40-bit timestamp

The returned value is guaranteed to be in the following range: 0 <= value <= 2^40 - 1

Trait Implementations

impl Add<Duration> for Instant[src]

type Output = Instant

The resulting type after applying the + operator.

impl Clone for Duration[src]

impl Copy for Duration[src]

impl Debug for Duration[src]

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

impl Eq for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl Serialize for Duration[src]

impl StructuralEq for Duration[src]

impl StructuralPartialEq for Duration[src]

Auto Trait Implementations

impl Send for Duration

impl Sync for Duration

impl Unpin for Duration

Blanket Implementations

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

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

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

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

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

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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.