pub struct Recycler {
pub num_allocations: usize,
}
Fields§
§num_allocations: usize
Implementations§
source§impl Recycler
impl Recycler
sourceconst MAX_EXTRA_CAPACITY_PERCENT: usize = 200usize
const MAX_EXTRA_CAPACITY_PERCENT: usize = 200usize
Maximum extra capacity that a recycled vector is allowed to have. If the actual capacity is larger, we re-allocate the vector storage with lower capacity.
sourceconst MIN_EXTRA_CAPACITY_PERCENT: usize = 20usize
const MIN_EXTRA_CAPACITY_PERCENT: usize = 20usize
Minimum extra capacity to keep when re-allocating the vector storage.
sourceconst MIN_VECTOR_LENGTH: usize = 16usize
const MIN_VECTOR_LENGTH: usize = 16usize
Minimum sensible vector length to consider for re-allocation.
pub fn new() -> Self
sourcepub fn recycle_vec<T>(&mut self, vec: &mut Vec<T>)
pub fn recycle_vec<T>(&mut self, vec: &mut Vec<T>)
Clear a vector for re-use, while retaining the backing memory buffer. May shrink the buffer if it’s currently much larger than was actually used.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Recycler
impl RefUnwindSafe for Recycler
impl Send for Recycler
impl Sync for Recycler
impl Unpin for Recycler
impl UnwindSafe for Recycler
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
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