pub struct ClockTimer { /* private fields */ }
Expand description
The ClockTimer type is a wrapper class for platform-specific clocks. It can be used for cycle counters and execution time clocks, for example.
Implementations§
Source§impl ClockTimer
impl ClockTimer
pub fn new(clock: Rc<RefCell<dyn SimpleClock>>) -> ClockTimer
pub fn new_box(clock: Rc<RefCell<dyn SimpleClock>>) -> TimerBox
Trait Implementations§
Source§impl Clone for ClockTimer
impl Clone for ClockTimer
Source§fn clone(&self) -> ClockTimer
fn clone(&self) -> ClockTimer
Returns a duplicate 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 moreSource§impl Timer for ClockTimer
impl Timer for ClockTimer
Source§fn start(&mut self)
fn start(&mut self)
The start() method starts a timing interval. It may be called
multiple times on a single instance. The last invocation of
the start method overrides any previous calls.
Source§fn finish(&mut self) -> i64
fn finish(&mut self) -> i64
The finish() method is used at the end of a sample interval.
It returns the interval time in ticks and also starts a new
interval, since the restart cost is nearly zero. Thus, finish()
can be called multiple times after a start() invocation to return
the times for a sequence of events. If a more precise timing is
required, the user must invoke start().
Auto Trait Implementations§
impl Freeze for ClockTimer
impl !RefUnwindSafe for ClockTimer
impl !Send for ClockTimer
impl !Sync for ClockTimer
impl Unpin for ClockTimer
impl !UnwindSafe for ClockTimer
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