pub struct Config<T: Default> {
pub capacity: usize,
pub prealloc: usize,
pub auto_reclaim: bool,
pub surpluspull_threshold_for_reclaim: usize,
pub idle_threshold_for_surpluspull: usize,
pub clear_func: Option<fn(&mut T)>,
/* private fields */
}Expand description
Configuration for the pool.
Fields§
§capacity: usizeMaximum capacity of the pool.
prealloc: usizeNumber of items to preallocate.
auto_reclaim: boolWhether to automatically reclaim allocated items and free them to reduce memory usage.
surpluspull_threshold_for_reclaim: usizeThreshold of surplus-pull continuous occurrence to trigger reclamation
when auto_reclaim is enabled.
idle_threshold_for_surpluspull: usizeThreshold for idle items to judge as a surplus-pull when auto_reclaim is enabled.
clear_func: Option<fn(&mut T)>Optional function to clear or reset an item before it is reused.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Config<T>
impl<T> RefUnwindSafe for Config<T>
impl<T> Send for Config<T>
impl<T> Sync for Config<T>
impl<T> Unpin for Config<T>
impl<T> UnwindSafe for Config<T>
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