pub struct DispatcherBuilder { /* private fields */ }Available on crate feature
dispatcher only.Expand description
A builder for Dispatcher.
Implementations§
Source§impl DispatcherBuilder
impl DispatcherBuilder
Sourcepub fn new() -> DispatcherBuilder
pub fn new() -> DispatcherBuilder
Create a builder with default settings.
Sourcepub fn concurrent(self, concurrent: bool) -> DispatcherBuilder
pub fn concurrent(self, concurrent: bool) -> DispatcherBuilder
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: NonZero<usize>) -> DispatcherBuilder
pub fn worker_threads(self, nthreads: NonZero<usize>) -> DispatcherBuilder
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) -> DispatcherBuilder
pub fn stack_size(self, s: usize) -> DispatcherBuilder
Set the size of stack of the worker threads.
Sourcepub fn thread_affinity(
self,
f: impl FnMut(usize) -> HashSet<usize> + 'static,
) -> DispatcherBuilder
pub fn thread_affinity( self, f: impl FnMut(usize) -> HashSet<usize> + 'static, ) -> DispatcherBuilder
Set the thread affinity for the dispatcher.
Sourcepub fn thread_names(
self,
f: impl FnMut(usize) -> String + 'static,
) -> DispatcherBuilder
pub fn thread_names( self, f: impl FnMut(usize) -> String + 'static, ) -> DispatcherBuilder
Provide a function to assign names to the worker threads.
Sourcepub fn proactor_builder(self, builder: ProactorBuilder) -> DispatcherBuilder
pub fn proactor_builder(self, builder: ProactorBuilder) -> DispatcherBuilder
Set the proactor builder for the inner runtimes.
Sourcepub fn build(self) -> Result<Dispatcher, Error>
pub fn build(self) -> Result<Dispatcher, Error>
Build the Dispatcher.
Trait Implementations§
Source§impl Default for DispatcherBuilder
impl Default for DispatcherBuilder
Source§fn default() -> DispatcherBuilder
fn default() -> DispatcherBuilder
Returns the “default value” for a type. Read more
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more