Struct safina_timer::DeadlineFuture
source · [−]Expand description
A future wrapper that returns DeadlineExceeded
at a specified deadline.
It is returned by with_deadline
and with_timeout
.
Implementations
sourceimpl<Fut: Future + Unpin> DeadlineFuture<Fut>
impl<Fut: Future + Unpin> DeadlineFuture<Fut>
sourcepub fn new(inner: Fut, deadline: Instant) -> Self
pub fn new(inner: Fut, deadline: Instant) -> Self
Makes a future that awaits inner
,
but returns DeadlineError
after deadline
.
Note that inner
must be
Unpin
.
Use std::boxed::Box::pin
to make it Unpin.
Or use pin_utils::pin_mut
to do it with unsafe code that does not allocate memory.
Trait Implementations
sourceimpl<Fut: Future + Unpin> Future for DeadlineFuture<Fut>
impl<Fut: Future + Unpin> Future for DeadlineFuture<Fut>
type Output = Result<Fut::Output, DeadlineError>
type Output = Result<Fut::Output, DeadlineError>
The type of value produced on completion.
Auto Trait Implementations
impl<Fut> RefUnwindSafe for DeadlineFuture<Fut> where
Fut: RefUnwindSafe,
impl<Fut> Send for DeadlineFuture<Fut> where
Fut: Send,
impl<Fut> Sync for DeadlineFuture<Fut> where
Fut: Sync,
impl<Fut> Unpin for DeadlineFuture<Fut>
impl<Fut> UnwindSafe for DeadlineFuture<Fut> where
Fut: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for F where
F: Future,
impl<F> IntoFuture for F where
F: Future,
type Output = <F as Future>::Output
type Output = <F as Future>::Output
🔬 This is a nightly-only experimental API. (
into_future
)The output that the future will produce on completion.
type IntoFuture = F
type IntoFuture = F
🔬 This is a nightly-only experimental API. (
into_future
)Which kind of future are we turning this into?
sourcefn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
🔬 This is a nightly-only experimental API. (
into_future
)Creates a future from a value.