Struct RobotClock
pub struct RobotClock { /* private fields */ }
Expand description
A running Robot clock. The clock is a monotonic clock that starts at an arbitrary reference time. It is clone resilient, ie a clone will be the same clock, even when mocked.
Implementations§
§impl RobotClock
impl RobotClock
pub fn new() -> RobotClock
pub fn new() -> RobotClock
Creates a RobotClock using now as its reference time. It will start a 0ns incrementing monotonically.
pub fn from_ref_time(ref_time_ns: u64) -> RobotClock
pub fn from_ref_time(ref_time_ns: u64) -> RobotClock
Builds a monotonic clock starting at the given reference time.
pub fn mock() -> (RobotClock, RobotClockMock)
pub fn mock() -> (RobotClock, RobotClockMock)
Build a fake clock with a reference time of 0. The RobotMock interface enables you to control all the clones of the clock given.
pub fn now(&self) -> CuDuration
pub fn recent(&self) -> CuDuration
Trait Implementations§
§impl Clone for RobotClock
impl Clone for RobotClock
§fn clone(&self) -> RobotClock
fn clone(&self) -> RobotClock
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for RobotClock
impl Debug for RobotClock
§impl Default for RobotClock
impl Default for RobotClock
§fn default() -> RobotClock
fn default() -> RobotClock
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RobotClock
impl RefUnwindSafe for RobotClock
impl Send for RobotClock
impl Sync for RobotClock
impl Unpin for RobotClock
impl UnwindSafe for RobotClock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more