[][src]Trait futures_lite::future::FutureExt

pub trait FutureExt: Future {
    fn boxed(self) -> Boxed<Self::Output>
    where
        Self: Sized + Send + 'static
, { ... }
fn boxed_local(self) -> BoxedLocal<Self::Output>
    where
        Self: Sized + 'static
, { ... } }

Extension trait for Future.

Provided methods

fn boxed(self) -> Boxed<Self::Output> where
    Self: Sized + Send + 'static, 

Boxes the future and changes its type to dyn Future<Output = T> + Send.

Examples

use futures_lite::*;

let a = future::ready('a');
let b = future::pending();

// Futures of different types can be stored in
// the same collection when they are boxed:
let futures = vec![a.boxed(), b.boxed()];

fn boxed_local(self) -> BoxedLocal<Self::Output> where
    Self: Sized + 'static, 

Boxes the future and changes its type to dyn Future<Output = T>.

Examples

use futures_lite::*;

let a = future::ready('a');
let b = future::pending();

// Futures of different types can be stored in
// the same collection when they are boxed:
let futures = vec![a.boxed_local(), b.boxed_local()];
Loading content...

Implementors

impl<T: ?Sized> FutureExt for T where
    T: Future
[src]

Loading content...