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.