pub struct BufferPool<const L: usize = 256, const U: usize = 4096> { /* private fields */ }Expand description
Two tier buffer pool with small and large slabs.
Implementations§
Source§impl<const L: usize, const U: usize> BufferPool<L, U>
impl<const L: usize, const U: usize> BufferPool<L, U>
Source§impl BufferPool
impl BufferPool
Sourcepub const fn upper_slot_size() -> usize
pub const fn upper_slot_size() -> usize
Upper slab slot size in bytes.
Sourcepub const fn lower_slot_size() -> usize
pub const fn lower_slot_size() -> usize
Lower slab slot size in bytes.
Source§impl<const L: usize, const U: usize> BufferPool<L, U>
impl<const L: usize, const U: usize> BufferPool<L, U>
Sourcepub fn dealloc_addr(&self, addr: u64) -> Result<(), AllocError>
pub fn dealloc_addr(&self, addr: u64) -> Result<(), AllocError>
Free a previously allocated block by its start address.
Sourcepub fn allocation_len(&self, addr: u64) -> Result<usize, AllocError>
pub fn allocation_len(&self, addr: u64) -> Result<usize, AllocError>
Capacity of a live allocation by its start address.
Trait Implementations§
Source§impl<const L: usize, const U: usize> BufferProvider for BufferPool<L, U>
impl<const L: usize, const U: usize> BufferProvider for BufferPool<L, U>
Source§fn max_alloc_len(&self) -> usize
fn max_alloc_len(&self) -> usize
Preferred maximum size of one allocation segment.
Source§fn alloc(&self, len: usize) -> Result<Allocation, AllocError>
fn alloc(&self, len: usize) -> Result<Allocation, AllocError>
Allocate one buffer that can hold at least
len bytes.Source§fn alloc_sg(
&self,
total_len: usize,
) -> Result<SmallVec<[Allocation; 4]>, AllocError>
fn alloc_sg( &self, total_len: usize, ) -> Result<SmallVec<[Allocation; 4]>, AllocError>
Allocate scatter/gather segments for a logical payload of
total_len bytes.Auto Trait Implementations§
impl<const L: usize = 256, const U: usize = 4096> !RefUnwindSafe for BufferPool<L, U>
impl<const L: usize = 256, const U: usize = 4096> !Sync for BufferPool<L, U>
impl<const L: usize = 256, const U: usize = 4096> !UnwindSafe for BufferPool<L, U>
impl<const L: usize, const U: usize> Freeze for BufferPool<L, U>
impl<const L: usize, const U: usize> Send for BufferPool<L, U>
impl<const L: usize, const U: usize> Unpin for BufferPool<L, U>
impl<const L: usize, const U: usize> UnsafeUnpin for BufferPool<L, U>
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