pub struct FixedBufPool { /* private fields */ }
Expand description
Thread-safe pool of FixedBuf
values, which are byte arrays with a fixed length.
This can be cheaply cloned to share the same underlying pool around.
The maximum length is 2^64, and the minimum alignment is 64. This allows storing the pointer and capacity in one usize
, making it much faster to move the FixedBuf
value around.
Implementations§
Source§impl FixedBufPool
impl FixedBufPool
pub fn with_alignment(align: usize) -> Self
pub fn new() -> Self
pub fn allocate_from_data(&self, data: impl AsRef<[u8]>) -> FixedBuf
Sourcepub fn allocate_with_zeros(&self, cap: usize) -> FixedBuf
pub fn allocate_with_zeros(&self, cap: usize) -> FixedBuf
cap
must be a power of two. It can safely be zero, but it will still cause an allocation of one byte due to rounding.
Trait Implementations§
Source§impl Clone for FixedBufPool
impl Clone for FixedBufPool
Source§fn clone(&self) -> FixedBufPool
fn clone(&self) -> FixedBufPool
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FixedBufPool
impl !RefUnwindSafe for FixedBufPool
impl Send for FixedBufPool
impl Sync for FixedBufPool
impl Unpin for FixedBufPool
impl !UnwindSafe for FixedBufPool
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