Struct governor::clock::FakeRelativeClock[][src]

pub struct FakeRelativeClock { /* fields omitted */ }
Expand description

A mock implementation of a clock. All it does is keep track of what “now” is (relative to some point meaningful to the program), and returns that.

Thread safety

The mock time is represented as an atomic u64 count of nanoseconds, behind an Arc. Clones of this clock will all show the same time, even if the original advances.

Implementations

Advances the fake clock by the given amount.

Trait Implementations

A measurement of a monotonically increasing clock.

Returns a measurement of the clock.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Compares two fake relative clocks’ current state, snapshotted.

let clock1 = FakeRelativeClock::default();
let clock2 = FakeRelativeClock::default();
assert_eq!(clock1, clock2);
clock1.advance(Duration::from_secs(1));
assert_ne!(clock1, clock2);

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.