pub struct DedicatedWorkerThreadSpawner<T, F>{ /* private fields */ }
Expand description
Spawns worker threads dedicated to a single dispatcher, with all threads using the same handler function. Optimizes for single-receiver scenarios by avoiding select overhead.
Implementations§
Source§impl<T: Send + 'static> DedicatedWorkerThreadSpawner<T, fn(_: T)>
Handle for initializing a group of dedicated worker threads.
impl<T: Send + 'static> DedicatedWorkerThreadSpawner<T, fn(_: T)>
Handle for initializing a group of dedicated worker threads.
Source§impl<T: Send + 'static, F> DedicatedWorkerThreadSpawner<T, F>
impl<T: Send + 'static, F> DedicatedWorkerThreadSpawner<T, F>
Sourcepub fn set_cores(self, cores: Vec<CoreId>) -> Self
pub fn set_cores(self, cores: Vec<CoreId>) -> Self
Sets the CPU cores that worker threads will be pinned to.
Sourcepub fn set_batch_size(self, batch_size: usize) -> Self
pub fn set_batch_size(self, batch_size: usize) -> Self
Sets the batch size for processing messages.
Sourcepub fn set_dispatcher(self, dispatcher: Arc<ChannelDispatcher<T>>) -> Self
pub fn set_dispatcher(self, dispatcher: Arc<ChannelDispatcher<T>>) -> Self
Sets the single dispatcher that all worker threads will process subscriptions from.
Sourcepub fn set_handler<G>(self, handler: G) -> DedicatedWorkerThreadSpawner<T, G>
pub fn set_handler<G>(self, handler: G) -> DedicatedWorkerThreadSpawner<T, G>
Sets the handler function that will process all subscriptions. Changes the function type parameter.
Trait Implementations§
Auto Trait Implementations§
impl<T, F> Freeze for DedicatedWorkerThreadSpawner<T, F>where
F: Freeze,
impl<T, F> RefUnwindSafe for DedicatedWorkerThreadSpawner<T, F>where
F: RefUnwindSafe,
impl<T, F> Send for DedicatedWorkerThreadSpawner<T, F>where
T: Send,
impl<T, F> Sync for DedicatedWorkerThreadSpawner<T, F>where
T: Send,
impl<T, F> Unpin for DedicatedWorkerThreadSpawner<T, F>where
F: Unpin,
impl<T, F> UnwindSafe for DedicatedWorkerThreadSpawner<T, F>where
F: UnwindSafe,
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