pub struct PooledBuffer { /* private fields */ }Expand description
A buffer borrowed from a pool that automatically returns on drop.
Provides RAII semantics - the buffer is automatically returned to the pool when dropped, ensuring no buffer leaks even in error conditions.
§Safety
Maintains all safety guarantees of PinnedBuffer while adding
automatic pool return semantics.
Implementations§
Source§impl PooledBuffer
impl PooledBuffer
Sourcepub fn buffer(&self) -> &PinnedBuffer<[u8]>
pub fn buffer(&self) -> &PinnedBuffer<[u8]>
Get a reference to the underlying buffer.
§Panics
Panics if the buffer has already been returned (internal bug).
Sourcepub fn buffer_mut(&mut self) -> &mut PinnedBuffer<[u8]>
pub fn buffer_mut(&mut self) -> &mut PinnedBuffer<[u8]>
Get a mutable reference to the underlying buffer.
§Panics
Panics if the buffer has already been returned (internal bug).
Sourcepub fn as_mut_slice(&mut self) -> Pin<&mut [u8]>
pub fn as_mut_slice(&mut self) -> Pin<&mut [u8]>
Get a pinned mutable slice reference to the buffer data.
This maintains pinning guarantees required for io_uring operations.
Sourcepub fn detach(self) -> PinnedBuffer<[u8]>
pub fn detach(self) -> PinnedBuffer<[u8]>
Detach the buffer from the pool, taking ownership.
This removes the buffer from pool management, preventing automatic return on drop. Use when you need to transfer ownership elsewhere.