pub struct BytePool { /* private fields */ }Expand description
A pool of reusable byte buffers to reduce allocation overhead.
Implementations§
Source§impl BytePool
impl BytePool
pub fn new(buffer_size: usize) -> Self
pub fn acquire(&mut self) -> Vec<u8> ⓘ
pub fn release(&mut self, buf: Vec<u8>)
pub fn free_count(&self) -> usize
pub fn total_allocated(&self) -> usize
pub fn buffer_size(&self) -> usize
pub fn shrink(&mut self, max_free: usize)
pub fn clear(&mut self)
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BytePool
impl RefUnwindSafe for BytePool
impl Send for BytePool
impl Sync for BytePool
impl Unpin for BytePool
impl UnsafeUnpin for BytePool
impl UnwindSafe for BytePool
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