Enum TryMaybeDone

pub enum TryMaybeDone<Fut: TryFuture>

A future that may have completed with an error.

This is created by the [try_maybe_done()] function.

Variants

Future(Fut)

A not-yet-completed future

Done(Fut::Ok)

The output of the completed future

Gone

The empty variant after the result of a TryMaybeDone has been taken using the take_output method, or if the future returned an error.

Implementations

impl<Fut: TryFuture> TryMaybeDone<Fut>

fn output_mut(self: Pin<&mut Self>) -> Option<&mut Fut::Ok>

Returns an Option containing a mutable reference to the output of the future. The output of this method will be Some if and only if the inner future has completed successfully and take_output has not yet been called.

fn take_output(self: Pin<&mut Self>) -> Option<Fut::Ok>

Attempt to take the output of a TryMaybeDone without driving it towards completion.

Trait Implementations

impl<Fut: Debug + TryFuture> Debug for TryMaybeDone<Fut> where Fut::Ok: Debug,

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<Fut: TryFuture + Unpin> Unpin for TryMaybeDone<Fut>

impl<Fut: TryFuture> FusedFuture for TryMaybeDone<Fut>

fn is_terminated(&self) -> bool

impl<Fut: TryFuture> Future for TryMaybeDone<Fut>

type Output = Result<(), <Fut as TryFuture>::Error>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

Auto Trait Implementations

impl<Fut> Freeze for TryMaybeDone<Fut> where Fut: Freeze, <Fut as TryFuture>::Ok: Freeze,

impl<Fut> RefUnwindSafe for TryMaybeDone<Fut> where Fut: RefUnwindSafe, <Fut as TryFuture>::Ok: RefUnwindSafe,

impl<Fut> Send for TryMaybeDone<Fut> where Fut: Send, <Fut as TryFuture>::Ok: Send,

impl<Fut> Sync for TryMaybeDone<Fut> where Fut: Sync, <Fut as TryFuture>::Ok: Sync,

impl<Fut> UnsafeUnpin for TryMaybeDone<Fut> where Fut: UnsafeUnpin, <Fut as TryFuture>::Ok: UnsafeUnpin,

impl<Fut> UnwindSafe for TryMaybeDone<Fut> where Fut: UnwindSafe, <Fut as TryFuture>::Ok: UnwindSafe,

Blanket Implementations

impl<F> IntoFuture for TryMaybeDone<Fut> where F: Future,

type Output = <F as Future>::Output;
type IntoFuture = F;
fn into_future(self) -> <F as IntoFuture>::IntoFuture

impl<F, T, E> TryFuture for TryMaybeDone<Fut> where F: Future<Output = Result<T, E>> + ?Sized,

type Ok = T;
type Error = E;
fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>

impl<Fut> TryFutureExt for TryMaybeDone<Fut> where Fut: TryFuture + ?Sized,

impl<T> Any for TryMaybeDone<Fut> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for TryMaybeDone<Fut> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for TryMaybeDone<Fut> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for TryMaybeDone<Fut>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FutureExt for TryMaybeDone<Fut> where T: Future + ?Sized,

impl<T, U> Into<U> for TryMaybeDone<Fut> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for TryMaybeDone<Fut> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for TryMaybeDone<Fut> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>