[][src]Trait smol::future::FutureExt

pub trait FutureExt: Future {
    fn boxed(
        self
    ) -> Pin<Box<dyn Future<Output = Self::Output> + 'static + Send>>

Important traits for Pin<P>

impl<P> Future for Pin<P> where
    P: Unpin + DerefMut,
    <P as Deref>::Target: Future
type Output = <<P as Deref>::Target as Future>::Output;

    where
        Self: Send + 'static
, { ... }
fn boxed_local(
        self
    ) -> Pin<Box<dyn Future<Output = Self::Output> + 'static>>

Important traits for Pin<P>

impl<P> Future for Pin<P> where
    P: Unpin + DerefMut,
    <P as Deref>::Target: Future
type Output = <<P as Deref>::Target as Future>::Output;

    where
        Self: 'static
, { ... } }

Extension trait for Future.

Provided methods

fn boxed(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'static + Send>>

Important traits for Pin<P>

impl<P> Future for Pin<P> where
    P: Unpin + DerefMut,
    <P as Deref>::Target: Future
type Output = <<P as Deref>::Target as Future>::Output;
where
    Self: 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) -> Pin<Box<dyn Future<Output = Self::Output> + 'static>>

Important traits for Pin<P>

impl<P> Future for Pin<P> where
    P: Unpin + DerefMut,
    <P as Deref>::Target: Future
type Output = <<P as Deref>::Target as Future>::Output;
where
    Self: '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> FutureExt for T where
    T: Future + ?Sized
[src]

Loading content...