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> DeadlineFuture<Fut> where
Fut: Future + Unpin,
impl<Fut> DeadlineFuture<Fut> where
Fut: Future + Unpin,
sourcepub fn new(inner: Fut, deadline: Instant) -> DeadlineFuture<Fut>ⓘNotable traits for DeadlineFuture<Fut>impl<Fut> Future for DeadlineFuture<Fut> where
Fut: Future + Unpin, type Output = Result<<Fut as Future>::Output, DeadlineError>;
pub fn new(inner: Fut, deadline: Instant) -> DeadlineFuture<Fut>ⓘNotable traits for DeadlineFuture<Fut>impl<Fut> Future for DeadlineFuture<Fut> where
Fut: Future + Unpin, type Output = Result<<Fut as Future>::Output, DeadlineError>;
Fut: Future + Unpin, type Output = Result<<Fut as Future>::Output, DeadlineError>;
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 for DeadlineFuture<Fut> where
Fut: Future + Unpin,
impl<Fut> Future for DeadlineFuture<Fut> where
Fut: Future + Unpin,
type Output = Result<<Fut as Future>::Output, DeadlineError>
type Output = Result<<Fut as Future>::Output, DeadlineError>
The type of value produced on completion.
sourcefn poll(
self: Pin<&mut DeadlineFuture<Fut>>,
cx: &mut Context<'_>
) -> Poll<<DeadlineFuture<Fut> as Future>::Output>
fn poll(
self: Pin<&mut DeadlineFuture<Fut>>,
cx: &mut Context<'_>
) -> Poll<<DeadlineFuture<Fut> as Future>::Output>
Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
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.