Skip to main content

MaybeSendFuture

Trait MaybeSendFuture 

Source
pub trait MaybeSendFuture: Future + Send { }
Expand description

Trait alias for Future + MaybeSend.

On native: Future + Send — allows tokio::spawn. On WASM: just Future — no Send requirement.

Use in return-position impl trait in trait methods:

fn poll_demand(&mut self) -> impl MaybeSendFuture<Output = Option<Plan>>;

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Future + Send> MaybeSendFuture for T

Available on non-WebAssembly only.