Enum tokio::future::maybe_done::MaybeDone
source · #[repr(C)]pub enum MaybeDone<Fut: Future> {
Future {
future: Fut,
},
Done {
output: Fut::Output,
},
Gone,
}
Expand description
A future that may have completed.
Variants§
Future
A not-yet-completed future.
Fields
§
future: Fut
Done
The output of the completed future.
Gone
The empty variant after the result of a MaybeDone
has been
taken using the take_output
method.
Implementations§
source§impl<Fut: Future> MaybeDone<Fut>
impl<Fut: Future> MaybeDone<Fut>
sourcepub fn output_mut(self: Pin<&mut Self>) -> Option<&mut Fut::Output>
pub fn output_mut(self: Pin<&mut Self>) -> Option<&mut Fut::Output>
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 been completed and take_output
has not yet been called.
sourcepub fn take_output(self: Pin<&mut Self>) -> Option<Fut::Output>
pub fn take_output(self: Pin<&mut Self>) -> Option<Fut::Output>
Attempts to take the output of a MaybeDone
without driving it
towards completion.
Trait Implementations§
impl<'__pin, Fut: Future> Unpin for MaybeDone<Fut>where
PinnedFieldsOf<__Origin<'__pin, Fut>>: Unpin,
Auto Trait Implementations§
impl<Fut> Freeze for MaybeDone<Fut>
impl<Fut> RefUnwindSafe for MaybeDone<Fut>
impl<Fut> Send for MaybeDone<Fut>
impl<Fut> Sync for MaybeDone<Fut>
impl<Fut> UnwindSafe for MaybeDone<Fut>
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<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