[−][src]Struct tokio_io_pool::Builder
Builds an I/O-oriented thread pool (Runtime
) with custom configuration values.
Methods can be chained in order to set the configuration values. The thread pool is constructed
by calling Builder::build
. New instances of Builder
are obtained via
[Builder::default
].
See function level documentation for details on the various configuration settings.
Methods
impl Builder
[src]
pub fn pool_size(&mut self, val: usize) -> &mut Self
[src]
Set the number of worker threads for the thread pool instance.
This must be a number between 1 and 32,768 though it is advised to keep this value on the smaller side.
The default value is the number of cores available to the system.
pub fn name_prefix<S: Into<String>>(&mut self, val: S) -> &mut Self
[src]
Set name prefix of threads spawned by the scheduler
Thread name prefix is used for generating thread names. For example, if prefix is
my-pool-
, then threads in the pool will get names like my-pool-1
etc.
If this configuration is not set, then the thread will use the system default naming scheme.
pub fn after_start<F>(&mut self, f: F) -> &mut Self where
F: Fn() + Send + Sync + 'static,
[src]
F: Fn() + Send + Sync + 'static,
Execute function f
after each thread is started but before it starts doing work.
This is intended for bookkeeping and monitoring use cases.
pub fn before_stop<F>(&mut self, f: F) -> &mut Self where
F: Fn() + Send + Sync + 'static,
[src]
F: Fn() + Send + Sync + 'static,
Execute function f
before each thread stops.
This is intended for bookkeeping and monitoring use cases.
pub fn build(&self) -> Result<Runtime>
[src]
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,