Struct tokio_timer::Timer
[−]
[src]
pub struct Timer { /* fields omitted */ }
A facility for scheduling timeouts
Methods
impl Timer
[src]
impl Timer
pub fn sleep(&self, duration: Duration) -> Sleep
[src]
pub fn sleep(&self, duration: Duration) -> Sleep
Returns a future that completes once the given instant has been reached
pub fn timeout<F, E>(&self, future: F, duration: Duration) -> Timeout<F> where
F: Future<Error = E>,
E: From<TimeoutError<F>>,
[src]
pub fn timeout<F, E>(&self, future: F, duration: Duration) -> Timeout<F> where
F: Future<Error = E>,
E: From<TimeoutError<F>>,
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
.
pub fn timeout_stream<T, E>(
&self,
stream: T,
duration: Duration
) -> TimeoutStream<T> where
T: Stream<Error = E>,
E: From<TimeoutError<T>>,
[src]
pub fn timeout_stream<T, E>(
&self,
stream: T,
duration: Duration
) -> TimeoutStream<T> where
T: Stream<Error = E>,
E: From<TimeoutError<T>>,
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
.
pub fn interval(&self, dur: Duration) -> Interval
[src]
pub 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
pub fn interval_at(&self, at: Instant, dur: Duration) -> Interval
[src]
pub 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]
impl Clone for Timer
fn clone(&self) -> Timer
[src]
fn clone(&self) -> Timer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Timer
[src]
impl Default for Timer
impl Debug for Timer
[src]
impl Debug for Timer