pub struct BytePool<T = Vec<u8>>where
T: Poolable,{ /* private fields */ }
Expand description
A pool of byte slices, that reuses memory.
Implementations§
Source§impl<T: Poolable> BytePool<T>
impl<T: Poolable> BytePool<T>
Sourcepub fn alloc(&self, size: usize) -> Block<'_, T>
pub fn alloc(&self, size: usize) -> Block<'_, T>
Allocates a new Block
, which represents a fixed sice byte slice.
If Block
is dropped, the memory is not freed, but rather it is returned into the pool.
The returned Block
contains arbitrary data, and must be zeroed or overwritten,
in cases this is needed.
Trait Implementations§
Auto Trait Implementations§
impl<T = Vec<u8>> !Freeze for BytePool<T>
impl<T> RefUnwindSafe for BytePool<T>
impl<T> Send for BytePool<T>where
T: Send,
impl<T> Sync for BytePool<T>where
T: Send,
impl<T> Unpin for BytePool<T>where
T: Unpin,
impl<T> UnwindSafe for BytePool<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