use fmt;use ;/// Stopwatch is a simple utility for measuring elapsed time./// The time when the stopwatch was started.start_time: ,/// The total elapsed time.elapsed_time: Duration,/// Creates a new `Stopwatch` with initial values.////// # Examples////// ```/// use std::time::Duration;/// use stopwatch::Stopwatch;////// let stopwatch = Stopwatch::new();////// assert_eq!(stopwatch.elapsed(), Duration::from_secs(0));/// ```Stopwatchstart_time: None,elapsed_time: from_secs,/// Starts the stopwatch. If the stopwatch is already running, this has no effect.////// # Examples////// ```/// use stopwatch::Stopwatch;////// let mut stopwatch = Stopwatch::new();////// stopwatch.start();////// assert_eq!(stopwatch.is_running(), true);/// ```if self.start_time.is_noneself.start_time = Some;/// Stops the stopwatch and adds the elapsed time since the start to the total elapsed time./// If the stopwatch is not running, this has no effect.////// # Examples////// ```/// use std::time::Duration;/// use stopwatch::Stopwatch;////// let mut stopwatch = Stopwatch::new();////// stopwatch.start();/// std::thread::sleep(std::time::Duration::from_secs(1));/// stopwatch.stop();////// assert!(!stopwatch.is_running())/// ```if let Some = self.start_timeself.elapsed_time += now - start_time;self.start_time = None;/// Resets the stopwatch. If the stopwatch is currently running, stops it before resetting.////// # Examples////// ```/// use std::time::Duration;/// use stopwatch::Stopwatch;////// let mut stopwatch = Stopwatch::new();////// stopwatch.start();/// std::thread::sleep(std::time::Duration::from_secs(1));/// stopwatch.reset();////// assert_eq!(stopwatch.elapsed(), Duration::from_secs(0));/// ```if self.is_runningself.stop;self.start_time = None;self.elapsed_time = from_secs;/// Gets the total elapsed time. If the stopwatch is running, adds the time since the start.////// # Examples////// ```/// use std::time::Duration;/// use stopwatch::Stopwatch;////// let mut stopwatch = Stopwatch::new();////// stopwatch.start();/// std::thread::sleep(Duration::from_secs(1));////// assert_eq!(stopwatch.elapsed().as_secs(), 1);/// ```if let Some = self.start_timeif self.is_runningreturn now.duration_since;self.elapsed_time/// Checks if the stopwatch is currently running.////// # Examples////// ```/// use std::time::Duration;/// use stopwatch::Stopwatch;////// let mut stopwatch = Stopwatch::new();/// assert!(!stopwatch.is_running());////// stopwatch.start();/// assert!(stopwatch.is_running());////// std::thread::sleep(Duration::from_secs(1));////// stopwatch.stop();/// assert!(!stopwatch.is_running());/// ```self.start_time.is_somewrite!