pub struct BufferPool { /* private fields */ }Expand description
Pool of reusable aligned buffers to avoid allocation overhead.
The pool uses a lock-free queue for thread-safe buffer acquisition and release with minimal contention.
Implementations§
Source§impl BufferPool
impl BufferPool
Sourcepub fn new(capacity: usize) -> BufferPool
pub fn new(capacity: usize) -> BufferPool
Creates a new buffer pool with the specified capacity.
§Arguments
capacity- Maximum number of buffers in the pool
Sourcepub fn acquire(
&self,
) -> Option<Box<AlignedBuffer<ironsbe_core::::buffer::{impl#10}::acquire::{constant#0}>>>
pub fn acquire( &self, ) -> Option<Box<AlignedBuffer<ironsbe_core::::buffer::{impl#10}::acquire::{constant#0}>>>
Acquires a buffer from the pool.
Returns None if the pool is empty.
Sourcepub fn release(
&self,
buffer: Box<AlignedBuffer<ironsbe_core::::buffer::{impl#10}::release::{constant#0}>>,
)
pub fn release( &self, buffer: Box<AlignedBuffer<ironsbe_core::::buffer::{impl#10}::release::{constant#0}>>, )
Releases a buffer back to the pool.
The buffer is zeroed before being returned to the pool for security.
§Arguments
buffer- Buffer to release
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 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