Struct tokio_timer::Delay [−][src]
A future that completes at a specified instant in time.
Instances of Delay
perform no work and complete with ()
once the
specified deadline has been reached.
Delay
has a resolution of one millisecond and should not be used for tasks
that require high-resolution timers.
Cancellation
Canceling a Delay
is done by dropping the value. No additional cleanup or
other work is required.
Implementations
impl Delay
[src]
pub fn new(deadline: Instant) -> Delay
[src]
Create a new Delay
instance that elapses at deadline
.
Only millisecond level resolution is guaranteed. There is no guarantee
as to how the sub-millisecond portion of deadline
will be handled.
Delay
should not be used for high-resolution timer use cases.
pub fn deadline(&self) -> Instant
[src]
Returns the instant at which the future will complete.
pub fn is_elapsed(&self) -> bool
[src]
Returns true if the Delay
has elapsed
A Delay
is elapsed when the requested duration has elapsed.
pub fn reset(&mut self, deadline: Instant)
[src]
Reset the Delay
instance to a new deadline.
Calling this function allows changing the instant at which the Delay
future completes without having to create new associated state.
This function can be called both before and after the future has completed.
Trait Implementations
impl Debug for Delay
[src]
impl Future for Delay
[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
fn poll(&mut self) -> Poll<Self::Item, Self::Error>
[src]
pub fn wait(self) -> Result<Self::Item, Self::Error>
[src]
pub fn map<F, U>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Item) -> U,
[src]
F: FnOnce(Self::Item) -> U,
pub fn map_err<F, E>(self, f: F) -> MapErr<Self, F> where
F: FnOnce(Self::Error) -> E,
[src]
F: FnOnce(Self::Error) -> E,
pub fn from_err<E>(self) -> FromErr<Self, E> where
E: From<Self::Error>,
[src]
E: From<Self::Error>,
pub fn then<F, B>(self, f: F) -> Then<Self, B, F> where
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
B: IntoFuture,
[src]
F: FnOnce(Result<Self::Item, Self::Error>) -> B,
B: IntoFuture,
pub fn and_then<F, B>(self, f: F) -> AndThen<Self, B, F> where
F: FnOnce(Self::Item) -> B,
B: IntoFuture<Error = Self::Error>,
[src]
F: FnOnce(Self::Item) -> B,
B: IntoFuture<Error = Self::Error>,
pub fn or_else<F, B>(self, f: F) -> OrElse<Self, B, F> where
F: FnOnce(Self::Error) -> B,
B: IntoFuture<Item = Self::Item>,
[src]
F: FnOnce(Self::Error) -> B,
B: IntoFuture<Item = Self::Item>,
pub fn select<B>(self, other: B) -> Select<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
[src]
B: IntoFuture<Item = Self::Item, Error = Self::Error>,
pub fn select2<B>(self, other: B) -> Select2<Self, <B as IntoFuture>::Future> where
B: IntoFuture,
[src]
B: IntoFuture,
pub fn join<B>(self, other: B) -> Join<Self, <B as IntoFuture>::Future> where
B: IntoFuture<Error = Self::Error>,
[src]
B: IntoFuture<Error = Self::Error>,
pub fn join3<B, C>(
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
C: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
[src]
self,
b: B,
c: C
) -> Join3<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future> where
C: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
pub fn join4<B, C, D>(
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
C: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
[src]
self,
b: B,
c: C,
d: D
) -> Join4<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future> where
C: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
pub fn join5<B, C, D, E>(
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
C: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
[src]
self,
b: B,
c: C,
d: D,
e: E
) -> Join5<Self, <B as IntoFuture>::Future, <C as IntoFuture>::Future, <D as IntoFuture>::Future, <E as IntoFuture>::Future> where
C: IntoFuture<Error = Self::Error>,
B: IntoFuture<Error = Self::Error>,
D: IntoFuture<Error = Self::Error>,
E: IntoFuture<Error = Self::Error>,
pub fn into_stream(self) -> IntoStream<Self>
[src]
pub fn flatten(self) -> Flatten<Self> where
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
[src]
Self::Item: IntoFuture,
<Self::Item as IntoFuture>::Error: From<Self::Error>,
pub fn flatten_stream(self) -> FlattenStream<Self> where
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
[src]
Self::Item: Stream,
<Self::Item as Stream>::Error == Self::Error,
pub fn fuse(self) -> Fuse<Self>
[src]
pub fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Item),
[src]
F: FnOnce(&Self::Item),
pub fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
Self: UnwindSafe,
pub fn shared(self) -> Shared<Self>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Delay
impl Send for Delay
impl Sync for Delay
impl Unpin for Delay
impl !UnwindSafe for Delay
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
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.
pub fn into_future(self) -> F
[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.
pub 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>,