pub trait ThreadPool:
Clone
+ Send
+ Sync
+ RefUnwindSafe
+ UnwindSafe
+ Unpin {
// Required methods
fn threads(&self) -> usize;
unsafe fn spawn_unchecked<'a, F, Fut, T>(
&self,
work: F,
) -> BoxFuture<'a, Result<T, Box<dyn Error + Send>>>
where F: FnOnce() -> Fut + Send + 'a,
Fut: Future<Output = T> + 'a,
T: Send + 'a;
// Provided method
fn spawn<F, Fut, T>(
&self,
work: F,
) -> BoxFuture<'static, Result<T, Box<dyn Error + Send>>>
where F: FnOnce() -> Fut + Send + 'static,
Fut: Future<Output = T> + 'static,
T: Send + 'static { ... }
}Required Methods§
fn threads(&self) -> usize
Provided Methods§
fn spawn<F, Fut, T>( &self, work: F, ) -> BoxFuture<'static, Result<T, Box<dyn Error + Send>>>
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.