pub struct MessagePool { /* private fields */ }Expand description
A pool of reusable messages
Uses a simple stack-based pool with thread-safe access. Messages are automatically returned to the pool when dropped.
Implementations§
Source§impl MessagePool
impl MessagePool
Sourcepub fn with_capacity(max_size: usize) -> Self
pub fn with_capacity(max_size: usize) -> Self
Create a new message pool with specified maximum capacity
Sourcepub fn acquire(&self) -> PooledMessage
pub fn acquire(&self) -> PooledMessage
Acquire a message from the pool
If the pool is empty, a new message is allocated. Otherwise, a recycled message is returned (after clearing).
Trait Implementations§
Source§impl Clone for MessagePool
impl Clone for MessagePool
Source§fn clone(&self) -> MessagePool
fn clone(&self) -> MessagePool
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 moreSource§impl Debug for MessagePool
impl Debug for MessagePool
Auto Trait Implementations§
impl Freeze for MessagePool
impl RefUnwindSafe for MessagePool
impl Send for MessagePool
impl Sync for MessagePool
impl Unpin for MessagePool
impl UnwindSafe for MessagePool
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