pub trait Spawn: Send + Sync {
// Required method
fn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>;
// Provided method
fn spawn<T: 'static + Send>(
&self,
name: impl Into<Arc<str>>,
fut: impl Future<Output = T> + Send + 'static,
) -> Task<T>
where Self: Sized { ... }
}
Expand description
Trait for spawning a task on an executor.
Required Methods§
sourcefn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>
fn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>
Gets a scheduler for a new task.