Struct ringtail::buffers::unbounded::UnboundedBuffer [−][src]
pub struct UnboundedBuffer<T> { /* fields omitted */ }
Growable ring buffer.
Optimized for repeated appending of bytes to the end and removing bytes from the front of the buffer.
Methods
impl<T: Copy> UnboundedBuffer<T>
[src]
impl<T: Copy> UnboundedBuffer<T>
pub const DEFAULT_CAPACITY: usize
DEFAULT_CAPACITY: usize = 4096
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new unbounded buffer with the default capacity.
pub fn with_capacity(capacity: usize) -> Self
[src]
pub fn with_capacity(capacity: usize) -> Self
Create a new unbounded buffer with a given minimum capacity pre-allocated.
Trait Implementations
impl<T: Copy> Default for UnboundedBuffer<T>
[src]
impl<T: Copy> Default for UnboundedBuffer<T>
fn default() -> UnboundedBuffer<T>
[src]
fn default() -> UnboundedBuffer<T>
Returns the "default value" for a type. Read more
impl<T> Buffer<T> for UnboundedBuffer<T>
[src]
impl<T> Buffer<T> for UnboundedBuffer<T>
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
Returns true
if the buffer is empty.
fn len(&self) -> usize
[src]
fn len(&self) -> usize
Returns the number of elements in the buffer.
fn capacity(&self) -> usize
[src]
fn capacity(&self) -> usize
Returns the current capacity of the buffer.
fn clear(&mut self)
[src]
fn clear(&mut self)
Clears all elements from the buffer and resets the length to zero.
impl<T: Copy> ReadableBuffer<T> for UnboundedBuffer<T>
[src]
impl<T: Copy> ReadableBuffer<T> for UnboundedBuffer<T>
fn copy_to(&self, dest: &mut [T]) -> usize
[src]
fn copy_to(&self, dest: &mut [T]) -> usize
Copy elements from the front of the buffer into the given slice. Read more
fn consume(&mut self, count: usize) -> usize
[src]
fn consume(&mut self, count: usize) -> usize
Consume up to count
elements from the front of the buffer and discards them. Read more
fn pull(&mut self, dest: &mut [T]) -> usize where
T: Copy,
[src]
fn pull(&mut self, dest: &mut [T]) -> usize where
T: Copy,
Pull elements from the front of the buffer into the given location, up to the length of the destination buffer. Read more
impl<T: Copy> WritableBuffer<T> for UnboundedBuffer<T>
[src]
impl<T: Copy> WritableBuffer<T> for UnboundedBuffer<T>
Auto Trait Implementations
impl<T> Send for UnboundedBuffer<T> where
T: Send,
impl<T> Send for UnboundedBuffer<T> where
T: Send,
impl<T> Sync for UnboundedBuffer<T> where
T: Sync,
impl<T> Sync for UnboundedBuffer<T> where
T: Sync,