Skip to main content

BoxFuture

Type Alias BoxFuture 

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

A heap-allocated, Send future — the return type of every dyn-safe async method in the framework.

Rust’s async fn in traits produces an unnameable opaque type, which cannot be put behind dyn. Every Rainier contract that needs to be a trait object (middleware, queue drivers, mail transports, auth guards) therefore returns this instead. Where a contract does not need to be a trait object it uses plain async fn and stays allocation-free.

Aliased Type§

#[repr(transparent)]
pub struct BoxFuture<'a, T> { /* private fields */ }