Struct tokio_timer::Timer
[−]
[src]
pub struct Timer { /* fields omitted */ }
A facility for scheduling timeouts
Methods
impl Timer
[src]
fn sleep(&self, duration: Duration) -> Sleep
Returns a future that completes once the given instant has been reached
fn timeout<F>(&self, future: F, duration: Duration) -> Timeout<F> where
F: Future,
F: Future,
Allow the given future to execute for at most duration
time.
If the given future completes within the given time, then the Timeout
future will complete with that result. If duration
expires, the
Timeout
future completes with a TimeoutError
.
fn timeout_stream<T>(&self, stream: T, duration: Duration) -> TimeoutStream<T> where
T: Stream,
T: Stream,
Allow the given stream to execute for at most duration
time per
yielded value.
If the given stream yields a value within the allocated duration, then
value is returned and the timeout is reset for the next value. If the
duration
expires, then the stream will error with a TimeoutError
.
fn interval(&self, dur: Duration) -> Interval
Creates a new interval which will fire at dur
time into the future,
and will repeat every dur
interval after
fn interval_at(&self, at: Instant, dur: Duration) -> Interval
Creates a new interval which will fire at the time specified by at
,
and then will repeat every dur
interval after
Trait Implementations
impl Clone for Timer
[src]
fn clone(&self) -> Timer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more