pub struct Timer { /* fields omitted */ }
A timer that sends values to the metrics backend
Timers can record time intervals in multiple ways :
- with the time! macrohich wraps an expression or block with start() and stop() calls.
- with the time(Fn) methodhich wraps a closure with start() and stop() calls.
- with start() and stop() methodsrapping around the operation to time
- with the interval_us() method, providing an externally determined microsecond interval
Record a microsecond interval for this timer
Can be used in place of start()/stop() if an external time interval source is used
Obtain a opaque handle to the current time.
The handle is passed back to the stop() method to record a time interval.
This is actually a convenience method to the TimeHandle::now()
Beware, handles obtained here are not bound to this specific timer instance
for now but might be in the future for safety.
If you require safe multi-timer handles, get them through TimeType::now()
Record the time elapsed since the start_time handle was obtained.
This call can be performed multiple times using the same handle,
reporting distinct time intervals each time.
Returns the microsecond interval value that was recorded.
Record the time taken to execute the provided closure
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static