pub struct ChunkPool { /* private fields */ }Expand description
A pool of available unused chunks.
The number of chunks stored in a ChunkPool is limited by [MAX_CHUNKS_IN_POOL],
and the size of each individual saved chunk is limited by [MAX_CHUNK_SIZE_IN_BYTES].
Implementations§
Source§impl ChunkPool
impl ChunkPool
Sourcepub fn put(&mut self, chunk: Vec<u8>)
pub fn put(&mut self, chunk: Vec<u8>)
Return a chunk back to the pool, or frees it, as appropriate.
chunk will be freed if either:
selfalready contains at least [MAX_CHUNKS_IN_POOL] chunks, orchunk.capacity()is greater than [MAX_CHUNK_SIZE_IN_BYTES].
These limits place an upper bound on the memory usage of a single ChunkPool.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChunkPool
impl RefUnwindSafe for ChunkPool
impl Send for ChunkPool
impl Sync for ChunkPool
impl Unpin for ChunkPool
impl UnwindSafe for ChunkPool
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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