pub struct BufferPool { /* private fields */ }Expand description
Pre-allocated, fixed-size buffer pool owned by one worker.
Implementations§
Source§impl BufferPool
impl BufferPool
Sourcepub fn new(capacity: usize, buf_size: usize) -> Option<Self>
pub fn new(capacity: usize, buf_size: usize) -> Option<Self>
Pre-allocates capacity slots of buf_size bytes.
Returns None when buf_size != DEFAULT_BUF_SIZE and the io_uring
feature would require matching registration granularity — callers
should keep the default size.
Sourcepub fn free_slots(&self) -> usize
pub fn free_slots(&self) -> usize
Free slot count.
Sourcepub fn take(&mut self) -> Option<u32>
pub fn take(&mut self) -> Option<u32>
Takes a slot, or None when the pool is exhausted (callers stop
reading — TCP backpressure does the rest).
Auto Trait Implementations§
impl Freeze for BufferPool
impl RefUnwindSafe for BufferPool
impl Send for BufferPool
impl Sync for BufferPool
impl Unpin for BufferPool
impl UnsafeUnpin 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