pal_async::task

Trait SpawnLocal

Source
pub trait SpawnLocal {
    // Required method
    fn scheduler_local(&self, metadata: &TaskMetadata) -> Arc<dyn Schedule>;

    // Provided method
    fn spawn_local<T: 'static>(
        &self,
        name: impl Into<Arc<str>>,
        fut: impl Future<Output = T> + 'static,
    ) -> Task<T>
       where Self: Sized { ... }
}
Expand description

Trait for spawning a non-Send task on an executor.

Required Methods§

Source

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

Gets a scheduler for a new task.

Provided Methods§

Source

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

Spawns a task.

Implementations on Foreign Types§

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§