pub struct Timeout<'timer, F> { /* private fields */ }
Expand description
A Future
that requires an inner Future
to complete within a
specified Duration
.
This Future
is returned by the timeout
and try_timeout
functions,
and by the Timer::timeout
and Timer::try_timeout
methods.
Output
Ok
(F::Output)
if the inner future completed before the specified timeout.Err
(
Elapsed
)
if the timeout elapsed before the innerFuture
completed.
Cancellation
Dropping a Timeout
future cancels the timeout. The wrapped Future
can
be extracted from the Timeout
future by calling Timeout::into_inner
,
allowing the future to be polled without failing if the timeout elapses.
Implementations§
Trait Implementations§
impl<'pin, 'timer, F> Unpin for Timeout<'timer, F>where
__Timeout<'pin, 'timer, F>: Unpin,
Auto Trait Implementations§
impl<'timer, F> !RefUnwindSafe for Timeout<'timer, F>
impl<'timer, F> Send for Timeout<'timer, F>where
F: Send,
impl<'timer, F> !Sync for Timeout<'timer, F>
impl<'timer, F> !UnwindSafe for Timeout<'timer, F>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more