pub struct BufferPool { /* private fields */ }Expand description
A pool of byte buffers that can be checked out and returned.
Implementations§
Source§impl BufferPool
impl BufferPool
pub fn new(buffer_size: usize, max_pool_size: usize) -> Self
pub fn checkout(&mut self) -> Vec<u8> ⓘ
pub fn return_buffer(&mut self, buf: Vec<u8>)
pub fn available(&self) -> usize
pub fn buffer_size(&self) -> usize
pub fn max_pool_size(&self) -> usize
pub fn total_checkouts(&self) -> u64
pub fn preallocate(&mut self, count: usize)
pub fn shrink_to(&mut self, target: usize)
pub fn clear(&mut self)
pub fn total_memory(&self) -> usize
Trait Implementations§
Source§impl Clone for BufferPool
impl Clone for BufferPool
Source§fn clone(&self) -> BufferPool
fn clone(&self) -> BufferPool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BufferPool
impl RefUnwindSafe for BufferPool
impl Send for BufferPool
impl Sync for BufferPool
impl Unpin for BufferPool
impl UnsafeUnpin for BufferPool
impl UnwindSafe for BufferPool
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