Struct Executors

Source
pub struct Executors<F, T>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
{ /* private fields */ }

Implementations§

Source§

impl<F, T> Executors<F, T>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,

Source

pub fn new_fixed_thread_pool( thread_count: u32, ) -> Result<ExecutorService<F, T>, ExecutorServiceError>

Creates a thread pool with a fixed size. All threads are initialized at first.

REMARKS: The maximum value for [thread_count] is currently MAX_THREAD_COUNT If you go beyond that, the function will fail, producing an ExecutorServiceError::ParameterError

Source

pub fn new_cached_thread_pool( initial_thread_count: Option<u32>, ) -> Result<ExecutorService<F, T>, ExecutorServiceError>

Creates a cached thread pool with an optional initial thread count. If the initial count is not provided, then a default of DEFAULT_INITIAL_CACHED_THREAD_COUNT threads will be initiated. When a new task is posted to the pool, if there are no threads available, then a new thread will be added to the pool and will then be cached. So the number of underlying threads is likely to increase with respect to the needs.

REMARKS: The maximum value for initial_thread_count is currently MAX_THREAD_COUNT. And the maximum number of thread that can be created is also limited to MAX_THREAD_COUNT by design. If more requests come and all threads are busy and we have a maximum of MAX_THREAD_COUNT threads, then it will behave like a constant thread pool.

Auto Trait Implementations§

§

impl<F, T> Freeze for Executors<F, T>

§

impl<F, T> RefUnwindSafe for Executors<F, T>
where F: RefUnwindSafe,

§

impl<F, T> Send for Executors<F, T>

§

impl<F, T> Sync for Executors<F, T>
where F: Sync,

§

impl<F, T> Unpin for Executors<F, T>
where F: Unpin,

§

impl<F, T> UnwindSafe for Executors<F, T>
where F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.