pub struct ExecutionTime { /* private fields */ }
Expand description
Measures the execution time of a code block.
This struct provides methods to start a timer and print the elapsed time in a user-friendly format.
Implementations§
Source§impl ExecutionTime
impl ExecutionTime
Sourcepub fn start() -> Self
pub fn start() -> Self
Starts a new stopwatch.
This function initializes the timer by recording the current time.
§Returns
A new ExecutionTime
instance.
Sourcepub fn get_elapsed_time(&self) -> String
pub fn get_elapsed_time(&self) -> String
Calculates the time elapsed since the timer was started.
This method calculates the elapsed time, formats it into a readable string.
Sourcepub fn print_elapsed_time(&self)
pub fn print_elapsed_time(&self)
Prints the time elapsed since the timer was started.
Auto Trait Implementations§
impl Freeze for ExecutionTime
impl RefUnwindSafe for ExecutionTime
impl Send for ExecutionTime
impl Sync for ExecutionTime
impl Unpin for ExecutionTime
impl UnwindSafe for ExecutionTime
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