Struct OptionFuture

struct OptionFuture<F> { ... }

A future representing a value which may or may not be present.

Created by the From implementation for Option.

Examples

# futures::executor::block_on(async {
use futures::future::OptionFuture;

let mut a: OptionFuture<_> = Some(async { 123 }).into();
assert_eq!(a.await, Some(123));

a = None.into();
assert_eq!(a.await, None);
# });

Implementations

impl<'__pin, F> Unpin for OptionFuture<F>

impl<F> Default for OptionFuture<F>

fn default() -> Self

impl<F> Freeze for OptionFuture<F>

impl<F> IntoFuture for OptionFuture<F>

fn into_future(self: Self) -> <F as IntoFuture>::IntoFuture

impl<F> RefUnwindSafe for OptionFuture<F>

impl<F> Send for OptionFuture<F>

impl<F> Sync for OptionFuture<F>

impl<F> UnsafeUnpin for OptionFuture<F>

impl<F> UnwindSafe for OptionFuture<F>

impl<F: $crate::clone::Clone> Clone for OptionFuture<F>

fn clone(self: &Self) -> OptionFuture<F>

impl<F: $crate::fmt::Debug> Debug for OptionFuture<F>

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

impl<F: FusedFuture> FusedFuture for OptionFuture<F>

fn is_terminated(self: &Self) -> bool

impl<F: Future> Future for OptionFuture<F>

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<<Self as >::Output>

impl<T> Any for OptionFuture<F>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for OptionFuture<F>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for OptionFuture<F>

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

impl<T> CloneToUninit for OptionFuture<F>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for OptionFuture<F>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> From for OptionFuture<T>

fn from(option: Option<T>) -> Self

impl<T> FutureExt for OptionFuture<F>

impl<T> ToOwned for OptionFuture<F>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for OptionFuture<F>

fn into(self: 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 for OptionFuture<F>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for OptionFuture<F>

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