pub struct Builder<T: Default> { /* private fields */ }Expand description
Implementations§
Source§impl<T: Default> Builder<T>
impl<T: Default> Builder<T>
Sourcepub fn prealloc(&mut self, prealloc: usize) -> &mut Self
pub fn prealloc(&mut self, prealloc: usize) -> &mut Self
Set the number of preallocated items in the pool.
Sourcepub fn clear_func(&mut self, func: fn(&mut T)) -> &mut Self
pub fn clear_func(&mut self, func: fn(&mut T)) -> &mut Self
Set the function to clear an item before it is returned to the pool.
Sourcepub fn auto_reclaim(&mut self, enable: bool) -> &mut Self
pub fn auto_reclaim(&mut self, enable: bool) -> &mut Self
Enable or disable auto reclaiming allocated items and free them to reduce memory usage.
Sourcepub fn enable_auto_reclaim(&mut self) -> &mut Self
pub fn enable_auto_reclaim(&mut self) -> &mut Self
Enable auto reclaiming allocated items and free them to reduce memory usage.
Sourcepub fn surpluspull_threshold_for_reclaim(
&mut self,
threshold: usize,
) -> &mut Self
pub fn surpluspull_threshold_for_reclaim( &mut self, threshold: usize, ) -> &mut Self
Set the threshold of surplus-pull continuous occurrence to trigger reclamation
when auto_reclaim is enabled.
Sourcepub fn idle_threshold_for_surpluspull(&mut self, threshold: usize) -> &mut Self
pub fn idle_threshold_for_surpluspull(&mut self, threshold: usize) -> &mut Self
Set the threshold for idle items to judge as a surplus-pull when auto_reclaim is enabled.
Auto Trait Implementations§
impl<T> Freeze for Builder<T>
impl<T> RefUnwindSafe for Builder<T>
impl<T> Send for Builder<T>
impl<T> Sync for Builder<T>
impl<T> Unpin for Builder<T>
impl<T> UnwindSafe for Builder<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