[−][src]Struct climer::timer::Timer
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
Auto Trait Implementations
impl Unpin for Timer
impl Send 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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,