Trait pal_async::task::Spawn

source ·
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§

source

fn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>

Gets a scheduler for a new task.

Provided Methods§

source

fn spawn<T: 'static + Send>( &self, name: impl Into<Arc<str>>, fut: impl Future<Output = T> + Send + 'static, ) -> Task<T>
where Self: Sized,

Spawns a task.

Implementations on Foreign Types§

source§

impl<T: ?Sized + Spawn> Spawn for &T

source§

fn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>

source§

impl<T: ?Sized + Spawn> Spawn for Box<T>

source§

fn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>

source§

impl<T: ?Sized + Spawn> Spawn for Arc<T>

source§

fn scheduler(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>

Implementors§