pub struct WithContext<Fut, E, C> { /* private fields */ }Expand description
Future wrapper produced by .with_context() to add error context.
Wraps the original future, and on error, attaches the context string lazily generated by the stored closure.
Trait Implementations§
Source§impl<Fut, T, E, C> Future for WithContext<Fut, E, C>
impl<Fut, T, E, C> Future for WithContext<Fut, E, C>
Source§fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
Polls the wrapped future, converting any error by adding context.
If the wrapped future resolves to Ok, passes the value through.
If Err, applies the context closure, wraps the error (without invoking hooks!).
Source§type Output = Result<T, AsyncError<E>>
type Output = Result<T, AsyncError<E>>
The type of value produced on completion.
Auto Trait Implementations§
impl<Fut, E, C> Freeze for WithContext<Fut, E, C>
impl<Fut, E, C> RefUnwindSafe for WithContext<Fut, E, C>
impl<Fut, E, C> Send for WithContext<Fut, E, C>
impl<Fut, E, C> Sync for WithContext<Fut, E, C>
impl<Fut, E, C> Unpin for WithContext<Fut, E, C>
impl<Fut, E, C> UnsafeUnpin for WithContext<Fut, E, C>where
Fut: UnsafeUnpin,
C: UnsafeUnpin,
impl<Fut, E, C> UnwindSafe for WithContext<Fut, E, C>
Blanket Implementations§
Source§impl<T, E, F> AsyncResultChainExt<T, E> for F
impl<T, E, F> AsyncResultChainExt<T, E> for F
Source§fn and_then_async<Fut, F, U>(self, f: F) -> AndThenAsync<Self, Fut, F> ⓘ
fn and_then_async<Fut, F, U>(self, f: F) -> AndThenAsync<Self, Fut, F> ⓘ
Chains an asynchronous computation to execute if the previous future resolves to
Ok. Read moreSource§impl<T, E, Fut> AsyncResultExt<T, E> for Fut
impl<T, E, Fut> AsyncResultExt<T, E> for Fut
Source§fn with_context<C>(self, ctx: C) -> WithContext<Self, E, C> ⓘ
fn with_context<C>(self, ctx: C) -> WithContext<Self, E, C> ⓘ
Adds context to an error produced by this future lazily. Read more
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<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