pub struct PoolConfig {
pub name: String,
pub size: usize,
pub queue_size: usize,
pub event_buffer: usize,
pub grace_period: Duration,
pub dispatch: DispatchStrategy,
pub overflow_policy: OverflowPolicy,
}Expand description
Configuration for a Pool.
Fields§
§name: StringHuman-readable name used in tracing.
size: usizeMaximum concurrent tasks (semaphore permits).
queue_size: usizeCapacity of the internal submit queue.
event_buffer: usizeBroadcast channel capacity for events per task.
grace_period: DurationGrace period given to in-flight tasks on shutdown.
dispatch: DispatchStrategyDispatch strategy (reserved for future multi-queue extensions).
overflow_policy: OverflowPolicyQueue overflow behavior.
Implementations§
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Create a named pool configuration with sensible defaults.
Sourcepub fn with_size(self, size: usize) -> Self
pub fn with_size(self, size: usize) -> Self
Set the maximum number of concurrent tasks.
Values below 1 are clamped to 1 inside Pool::new (with a tracing warning),
since a zero-sized pool can never execute tasks.
Sourcepub fn with_queue_size(self, queue_size: usize) -> Self
pub fn with_queue_size(self, queue_size: usize) -> Self
Set the capacity of the internal submit queue.
Sourcepub fn with_grace_period(self, d: Duration) -> Self
pub fn with_grace_period(self, d: Duration) -> Self
Set the grace period given to in-flight tasks during shutdown.
Sourcepub fn with_overflow_policy(self, overflow_policy: OverflowPolicy) -> Self
pub fn with_overflow_policy(self, overflow_policy: OverflowPolicy) -> Self
Set the queue overflow policy.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PoolConfig
impl RefUnwindSafe for PoolConfig
impl Send for PoolConfig
impl Sync for PoolConfig
impl Unpin for PoolConfig
impl UnsafeUnpin for PoolConfig
impl UnwindSafe for PoolConfig
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