[−][src]Struct futures_util::future::OptionFuture
#[must_use = "futures do nothing unless polled"]pub struct OptionFuture<F> { /* fields omitted */ }
A future representing a value which may or may not be present.
Created by the From
implementation for Option
.
Examples
#![feature(async_await, await_macro, futures_api)] use futures::future::{self, OptionFuture}; let mut a: OptionFuture<_> = Some(future::ready(123)).into(); assert_eq!(await!(a), Some(123)); a = None.into(); assert_eq!(await!(a), None);
Trait Implementations
impl<F: Debug> Debug for OptionFuture<F>
[src]
impl<F: Debug> Debug for OptionFuture<F>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<F: Clone> Clone for OptionFuture<F>
[src]
impl<F: Clone> Clone for OptionFuture<F>
fn clone(&self) -> OptionFuture<F>
[src]
fn clone(&self) -> OptionFuture<F>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<F: Future> Future for OptionFuture<F>
[src]
impl<F: Future> Future for OptionFuture<F>
type Output = Option<F::Output>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
The result of the Future
.
fn poll(self: PinMut<Self>, cx: &mut Context) -> Poll<Self::Output>
[src]
fn poll(self: PinMut<Self>, cx: &mut Context) -> Poll<Self::Output>
🔬 This is a nightly-only experimental API. (futures_api
)
futures in libcore are unstable
Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
impl<T> From<Option<T>> for OptionFuture<T>
[src]
impl<T> From<Option<T>> for OptionFuture<T>
Auto Trait Implementations
impl<F> Send for OptionFuture<F> where
F: Send,
impl<F> Send for OptionFuture<F> where
F: Send,
impl<F> Sync for OptionFuture<F> where
F: Sync,
impl<F> Sync for OptionFuture<F> where
F: Sync,