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§
type ThreadPool: ThreadPool + 'static
Required Methods§
fn processes(&self) -> usize
Sourceunsafe 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,
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§
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.