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.