Skip to main content

SpawnWorker

Trait SpawnWorker 

Source
pub trait SpawnWorker<J, F>: Runtime + Sized {
    // Required method
    fn spawn_worker(
        &self,
        name: String,
        worker: WorkerThread<J, Self>,
        f: F,
    ) -> Result<Self::JoinHandle<()>, Self::SpawnError>;
}
Expand description

A minimal description of a concurrent runtime that can spawn worker tasks for topograph

Required Methods§

Source

fn spawn_worker( &self, name: String, worker: WorkerThread<J, Self>, f: F, ) -> Result<Self::JoinHandle<()>, Self::SpawnError>

Spawn a new task to run the given worker with the given user-provided task

§Errors

This function may return an error if a task was unable to be spawned in the runtime

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<J: Send + 'static, E: AsyncExecutor, F: for<'h> AsyncHandler<J, Handle<'h, J, Nonblock<E>>, Output = ()> + Send + 'static> SpawnWorker<J, F> for Nonblock<E>

Source§

impl<J: Send + 'static, F: Fn(J, Handle<'_, J, Self>) + Send + 'static> SpawnWorker<J, F> for Blocking