[][src]Struct climer::timer::Timer

pub struct Timer {
    pub state: TimerState,
    // some fields omitted
}

Fields

state: TimerState

Methods

impl Timer[src]

pub fn builder() -> TimerBuilder[src]

Returns a new TimerBuilder.

pub fn new(target_time: Option<Time>, output: Option<Output>) -> Self[src]

Create a new Timer with the given optional arguments: target_time (Time), and output (Output). If a target_time is given, then the timer will act more like a countdown. If no target_time is given, then the timer will act more like a stopwatch; it will never finish naturally, so instead you need to stop the timer when necessary.

pub fn run(&mut self) -> ClimerResult[src]

Run the timer. This will lock the current thread until the time is up. If you want to update the timer yourself somewhere else, then don't call this method, instead call the update method to update the timer.

pub fn start(&mut self) -> ClimerResult[src]

Start the timer. Do not call this method directly if you are using the run method. Only call this method if you intend to update the timer manually by calling the update method.

pub fn stop(&mut self) -> ClimerResult[src]

Stops the timer, after it has been started using the start method.

pub fn pause(&mut self) -> ClimerResult[src]

Pauses the timer.

pub fn resume(&mut self) -> ClimerResult[src]

Resumes the timer from a paused state.

pub fn update(&mut self) -> ClimerResult[src]

Updates the timer. This will also attempt to write the remaining time to stdout or to a file, using the Output of this Timer.

pub fn print_output(&mut self) -> ClimerResult[src]

Print the current time to stdout or to a file using this timer's Output (if output exists).

pub fn time_output(&self) -> Time[src]

Returns a Time. If a target_time was given, then it returns the remaining time until the timer finishes; if no target_time was given, then it returns the time since the timer was started.

pub fn finish(&mut self) -> ClimerResult[src]

Finish the timer.

Trait Implementations

impl Default for Timer[src]

impl Clone for Timer[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Timer

impl Unpin for Timer

impl Sync for Timer

impl UnwindSafe for Timer

impl RefUnwindSafe for Timer

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]