pub struct UnboundedBufferPool(/* private fields */);Expand description
A pool with a growable number of Vec<u8> buffers.
Implementations§
Source§impl UnboundedBufferPool
impl UnboundedBufferPool
Sourcepub fn new(max_buffer_capacity: usize) -> Self
pub fn new(max_buffer_capacity: usize) -> Self
Create a new UnboundedBufferPool, 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§impl Clone for UnboundedBufferPool
impl Clone for UnboundedBufferPool
Source§fn clone(&self) -> UnboundedBufferPool
fn clone(&self) -> UnboundedBufferPool
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 UnboundedBufferPool
impl Debug for UnboundedBufferPool
Source§impl<S: Speed> MirroredClone<S> for UnboundedBufferPool
Available on crate feature clone-behavior only.
impl<S: Speed> MirroredClone<S> for UnboundedBufferPool
Available on crate feature
clone-behavior only.Source§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§
impl Freeze for UnboundedBufferPool
impl !RefUnwindSafe for UnboundedBufferPool
impl !Send for UnboundedBufferPool
impl !Sync for UnboundedBufferPool
impl Unpin for UnboundedBufferPool
impl !UnwindSafe for UnboundedBufferPool
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