ProcessPool

Trait ProcessPool 

Source
pub trait ProcessPool:
    Clone
    + Send
    + Sync
    + RefUnwindSafe
    + UnwindSafe
    + Unpin {
    type ThreadPool: ThreadPool + 'static;

    // Required methods
    fn processes(&self) -> usize;
    unsafe fn spawn_unchecked<'a, F, Fut, T>(
        &self,
        work: F,
    ) -> BoxFuture<'a, Result<T, Box<dyn Error + Send>>>
       where F: FnOnce(&Self::ThreadPool) -> Fut + ProcessSend + 'a,
             Fut: Future<Output = T> + 'a,
             T: ProcessSend + 'a;

    // Provided method
    fn spawn<F, Fut, T>(
        &self,
        work: F,
    ) -> BoxFuture<'static, Result<T, Box<dyn Error + Send>>>
       where F: FnOnce(&Self::ThreadPool) -> Fut + ProcessSend + 'static,
             Fut: Future<Output = T> + 'static,
             T: ProcessSend + 'static { ... }
}

Required Associated Types§

Required Methods§

Source

fn processes(&self) -> usize

Source

unsafe fn spawn_unchecked<'a, F, Fut, T>( &self, work: F, ) -> BoxFuture<'a, Result<T, Box<dyn Error + Send>>>
where F: FnOnce(&Self::ThreadPool) -> Fut + ProcessSend + 'a, Fut: Future<Output = T> + 'a, T: ProcessSend + 'a,

§Safety

Must be polled to completion before dropping. Unsound to forget it without having polled to completion.

Provided Methods§

Source

fn spawn<F, Fut, T>( &self, work: F, ) -> BoxFuture<'static, Result<T, Box<dyn Error + Send>>>
where F: FnOnce(&Self::ThreadPool) -> Fut + ProcessSend + 'static, Fut: Future<Output = T> + 'static, T: ProcessSend + 'static,

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.

Implementations on Foreign Types§

Source§

impl<P> ProcessPool for &P
where P: ProcessPool + ?Sized,

Source§

type ThreadPool = <P as ProcessPool>::ThreadPool

Source§

fn processes(&self) -> usize

Source§

fn spawn<F, Fut, T>( &self, work: F, ) -> BoxFuture<'static, Result<T, Box<dyn Error + Send>>>
where F: FnOnce(&Self::ThreadPool) -> Fut + ProcessSend + 'static, Fut: Future<Output = T> + 'static, T: ProcessSend + 'static,

Source§

unsafe fn spawn_unchecked<'a, F, Fut, T>( &self, work: F, ) -> BoxFuture<'a, Result<T, Box<dyn Error + Send>>>
where F: FnOnce(&Self::ThreadPool) -> Fut + ProcessSend + 'a, Fut: Future<Output = T> + 'a, T: ProcessSend + 'a,

Implementors§