Skip to main content

MaybeSend

Trait MaybeSend 

Source
pub trait MaybeSend: Send { }
Expand description

Send where the platform has threads; nothing on the web.

Spawning hands a future, its answer and everything it holds to a task. Natively that task runs on another thread, so they must move there; a page has one thread, and the task a page runs is a turn of its own queue, holding the page’s own values (a browser key, a page’s storage). Code that spawns takes this bound and stays one path on both targets: it requires Send exactly where moving is real.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T: Send + ?Sized> MaybeSend for T

Available on non-target_family=wasm only.