Struct tokio_timer_futures2::Timer
[−]
[src]
pub struct Timer { /* fields omitted */ }
A facility for scheduling timeouts
Methods
impl Timer
[src]
pub fn sleep(&self, duration: Duration) -> Sleep
[src]
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]
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]
&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]
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]
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
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more