Skip to main content

set_spawner

Function set_spawner 

Source
pub fn set_spawner(spawner: impl Spawner) -> Result<(), SpawnerAlreadySet>
Expand description

Install the process-wide spawner async exports run on.

Call once, before the first async export is launched (an initialization export or a library constructor is the natural place). Until it’s called, and forever after if it never is, the default executor is used (see the module docs).

§Errors

Returns SpawnerAlreadySet if a spawner was installed already; the first one wins.