pub struct DispatcherBuilder { /* private fields */ }
Expand description
A builder for Dispatcher
.
Implementations§
Source§impl DispatcherBuilder
impl DispatcherBuilder
Sourcepub fn concurrent(self, concurrent: bool) -> Self
pub fn concurrent(self, concurrent: bool) -> Self
If execute tasks concurrently. Default to be true
.
When set to false
, tasks are executed sequentially without any
concurrency within the thread.
Sourcepub fn worker_threads(self, nthreads: NonZeroUsize) -> Self
pub fn worker_threads(self, nthreads: NonZeroUsize) -> Self
Set the number of worker threads of the dispatcher. The default value is the CPU number. If the CPU number could not be retrieved, the default value is 1.
Sourcepub fn stack_size(self, s: usize) -> Self
pub fn stack_size(self, s: usize) -> Self
Set the size of stack of the worker threads.
Sourcepub fn thread_names(self, f: impl FnMut(usize) -> String + 'static) -> Self
pub fn thread_names(self, f: impl FnMut(usize) -> String + 'static) -> Self
Provide a function to assign names to the worker threads.
Sourcepub fn proactor_builder(self, builder: ProactorBuilder) -> Self
pub fn proactor_builder(self, builder: ProactorBuilder) -> Self
Set the proactor builder for the inner runtimes.
Sourcepub fn build(self) -> Result<Dispatcher>
pub fn build(self) -> Result<Dispatcher>
Build the Dispatcher
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DispatcherBuilder
impl !RefUnwindSafe for DispatcherBuilder
impl !Send for DispatcherBuilder
impl !Sync for DispatcherBuilder
impl Unpin for DispatcherBuilder
impl !UnwindSafe for DispatcherBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more