pub struct SharedUnboundedBufferPool(/* private fields */);Expand description
A threadsafe pool with a growable number of Vec<u8> buffers.
Implementations§
Sourcepub fn new(max_buffer_capacity: usize) -> Self
pub fn new(max_buffer_capacity: usize) -> Self
Create a new SharedUnboundedBufferPool, which initially has zero Vec<u8> buffers.
Whenever a buffer is returned to the pool, if its capacity is at most max_buffer_capacity,
then Vec::clear is run on it; otherwise, it is replaced with a new empty Vec<u8>.
Sourcepub fn get(&self) -> PooledBuffer<Self>
pub fn get(&self) -> PooledBuffer<Self>
Get a buffer from the pool, returning a new empty buffer if none were available in the pool.
Sourcepub fn pool_size(&self) -> usize
pub fn pool_size(&self) -> usize
Get the total number of buffers in this pool, whether available or in-use.
Sourcepub fn available_buffers(&self) -> usize
pub fn available_buffers(&self) -> usize
Get the number of buffers in the pool which are not currently being used.
Trait Implementations§
Source§fn clone(&self) -> SharedUnboundedBufferPool
fn clone(&self) -> SharedUnboundedBufferPool
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§fn mirrored_clone(&self) -> Self
fn mirrored_clone(&self) -> Self
Get a clone that shares all semantically-important mutable state with its source. Read more
Source§fn fast_mirrored_clone(&self) -> Selfwhere
S: FastSpeed,
fn fast_mirrored_clone(&self) -> Selfwhere
S: FastSpeed,
Get a clone that shares all semantically-important mutable state with its source. Read more
Auto Trait Implementations§
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