[][src]Struct sys_util::FakeClock

pub struct FakeClock { /* fields omitted */ }

A fake clock that can be used in tests to give exact control over the time. For a code example, see the tests in sys_util/src/timerfd.rs.

Methods

impl FakeClock[src]

pub fn new() -> Self[src]

pub fn now(&self) -> Self[src]

Get the current time, according to this clock.

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

Get the current time in ns, according to this clock.

pub fn duration_since(&self, earlier: &Self) -> Duration[src]

Get the duration since |earlier|, assuming that earlier < self.

pub fn add_event_fd(&mut self, deadline_ns: u64, fd: EventFd)[src]

Register the event fd for a notification when self's time is |deadline_ns|. Drop any existing events registered to the same raw fd.

pub fn add_ns(&mut self, ns: u64)[src]

Trait Implementations

impl Debug for FakeClock[src]

Auto Trait Implementations

impl Send for FakeClock

impl Sync for FakeClock

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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