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 innerFuturecompleted.
§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§
Source§impl<F: Future> Future for Timeout<'_, F>
impl<F: Future> Future for Timeout<'_, F>
impl<'pin, 'timer, F> Unpin for Timeout<'timer, F>where
__Timeout<'pin, 'timer, F>: Unpin,
Auto Trait Implementations§
impl<'timer, F> !Freeze for Timeout<'timer, F>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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,
Source§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