Skip to main content

BoxFuture

Type Alias BoxFuture 

Source
pub type BoxFuture<T> = Pin<Box<dyn Future<Output = T> + Send + 'static>>;
Expand description

Boxed, owned, Send future of unit output — the shape Runtime::spawn and Runtime::sleep work in.

'static lifetime because spawned futures outlive any borrow at the call site; Send because the default tokio impl is multi-threaded and the futures cross thread boundaries. On future WASM impls the Send bound is harmless — single-threaded executors accept Send futures.

Aliased Type§

pub struct BoxFuture<T> { /* private fields */ }