Skip to main content

SpawnStrategy

Trait SpawnStrategy 

Source
pub trait SpawnStrategy {
    type Return<T>;

    // Required method
    fn spawn<F: FnOnce() + Send + 'static, T>(
        with: T,
        worker: F,
    ) -> Self::Return<T>;
}
Expand description

Defines the worker thread spawn strategy.

Required Associated Types§

Source

type Return<T>

Required Methods§

Source

fn spawn<F: FnOnce() + Send + 'static, T>(with: T, worker: F) -> Self::Return<T>

Spawn a worker, passing in part of the return value.

The with parameter is for the Pending<R> that is paired with the responder created for the worker. This allows strategies to be made that return different return types thats Pending<R>.

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§