Skip to main content

Module stopwatch

Module stopwatch 

Source
Expand description

Stopwatch widget for displaying elapsed time.

Provides a Stopwatch widget that renders a formatted duration, and a StopwatchState that tracks elapsed time with start/stop/reset semantics.

§Example

use ftui_widgets::stopwatch::{Stopwatch, StopwatchState};
use std::time::Duration;

let mut state = StopwatchState::new();
assert_eq!(state.elapsed(), Duration::ZERO);
assert!(!state.running());

state.start();
state.tick(Duration::from_secs(1));
assert_eq!(state.elapsed(), Duration::from_secs(1));

Structs§

Stopwatch
A widget that displays elapsed time from a StopwatchState.
StopwatchState
State for the stopwatch, tracking elapsed time and running status.

Enums§

StopwatchFormat
Display format for the stopwatch.