Trait cfx_tasks::TaskSpawner
source · pub trait TaskSpawner: Send + Sync + Unpin + Debug + DynClone {
// Required methods
fn spawn(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>;
fn spawn_critical(
&self,
name: &'static str,
fut: BoxFuture<'static, ()>
) -> JoinHandle<()>;
fn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>;
fn spawn_critical_blocking(
&self,
name: &'static str,
fut: BoxFuture<'static, ()>
) -> JoinHandle<()>;
}
Required Methods§
sourcefn spawn(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>
fn spawn(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>
Spawns the task onto the runtime.
See also [Handle::spawn
].
sourcefn spawn_critical(
&self,
name: &'static str,
fut: BoxFuture<'static, ()>
) -> JoinHandle<()>
fn spawn_critical( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>
This spawns a critical task onto the runtime.
sourcefn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>
fn spawn_blocking(&self, fut: BoxFuture<'static, ()>) -> JoinHandle<()>
Spawns a blocking task onto the runtime.
sourcefn spawn_critical_blocking(
&self,
name: &'static str,
fut: BoxFuture<'static, ()>
) -> JoinHandle<()>
fn spawn_critical_blocking( &self, name: &'static str, fut: BoxFuture<'static, ()> ) -> JoinHandle<()>
This spawns a critical blocking task onto the runtime.