pub struct HeaderPool { /* private fields */ }Expand description
A pool of pre-allocated header buffers.
Uses round-robin allocation with no synchronization overhead. Thread-safe when used from a single thread (typical async executor usage).
Implementations§
Source§impl HeaderPool
impl HeaderPool
Sourcepub fn acquire(&mut self) -> &mut [u8; 11]
pub fn acquire(&mut self) -> &mut [u8; 11]
Acquire the next buffer from the pool (round-robin).
Returns a mutable reference to a 11-byte buffer. The buffer content is NOT cleared - it may contain old data.
Sourcepub fn encode(&mut self, header: &Header) -> &[u8; 11]
pub fn encode(&mut self, header: &Header) -> &[u8; 11]
Acquire and encode a header into a pooled buffer.
This is a convenience method that combines acquire() and encoding.
Sourcepub fn current_index(&self) -> usize
pub fn current_index(&self) -> usize
Get the current index (for debugging).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeaderPool
impl RefUnwindSafe for HeaderPool
impl Send for HeaderPool
impl Sync for HeaderPool
impl Unpin for HeaderPool
impl UnwindSafe for HeaderPool
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