[][src]Struct tokio_core::reactor::Timeout

#[must_use = "futures do nothing unless polled"]
pub struct Timeout { /* fields omitted */ }

A future representing the notification that a timeout has occurred.

Timeouts are created through the Timeout::new or Timeout::new_at methods indicating when a timeout should fire at. Note that timeouts are not intended for high resolution timers, but rather they will likely fire some granularity after the exact instant that they're otherwise indicated to fire at.

Methods

impl Timeout[src]

pub fn new(dur: Duration, handle: &Handle) -> Result<Timeout>[src]

Creates a new timeout which will fire at dur time into the future.

This function will return a Result with the actual timeout object or an error. The timeout object itself is then a future which will be set to fire at the specified point in the future.

pub fn new_at(at: Instant, handle: &Handle) -> Result<Timeout>[src]

Creates a new timeout which will fire at the time specified by at.

This function will return a Result with the actual timeout object or an error. The timeout object itself is then a future which will be set to fire at the specified point in the future.

pub fn reset(&mut self, at: Instant)[src]

Resets this timeout to an new timeout which will fire at the time specified by at.

This method is usable even of this instance of Timeout has "already fired". That is, if this future has resolved, calling this method means that the future will still re-resolve at the specified instant.

If at is in the past then this future will immediately be resolved (when poll is called).

Note that if any task is currently blocked on this future then that task will be dropped. It is required to call poll again after this method has been called to ensure that a task is blocked on this future.

Trait Implementations

impl Debug for Timeout[src]

impl Future for Timeout[src]

type Item = ()

The type of value that this future will resolved with if it is successful. Read more

type Error = Error

The type of error that this future will resolve with if it fails in a normal fashion. Read more

Auto Trait Implementations

impl !RefUnwindSafe for Timeout

impl Send for Timeout

impl Sync for Timeout

impl Unpin for Timeout

impl !UnwindSafe for Timeout

Blanket Implementations

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

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

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

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

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

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

impl<F> IntoFuture for F where
    F: Future
[src]

type Future = F

The future that this type can be converted into.

type Item = <F as Future>::Item

The item that the future may resolve with.

type Error = <F as Future>::Error

The error that the future may resolve with.

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.