Trait near_async::futures::AsyncComputationSpawner

source ·
pub trait AsyncComputationSpawner: Send + Sync {
    // Required method
    fn spawn_boxed(&self, name: &str, f: Box<dyn FnOnce() + Send>);
}
Expand description

Like FutureSpawner, but intended for spawning asynchronous computation-heavy tasks. Rather than taking a future, it takes a function. For production, the function shall be run on a separate thread (like rayon::spawn), but for test, it would run the function as a TestLoop event, possibly with an artificial delay.

Required Methods§

source

fn spawn_boxed(&self, name: &str, f: Box<dyn FnOnce() + Send>)

Trait Implementations§

source§

impl AsyncComputationSpawnerExt for dyn AsyncComputationSpawner + '_

source§

fn spawn(&self, name: &str, f: impl FnOnce() + Send + 'static)

Implementors§