Trait Buffer

Source
pub trait Buffer<T> {
    // Required methods
    fn try_push(&mut self, item: T) -> Result<(), CapacityError<T>>;
    fn as_slice(&self) -> &[T];
}
Expand description

Something which can store items sequentially in memory. This doesn’t necessarily require dynamic memory allocation.

Required Methods§

Source

fn try_push(&mut self, item: T) -> Result<(), CapacityError<T>>

Try to add another item to this Buffer, returning the item if there is no more room.

Source

fn as_slice(&self) -> &[T]

The items currently stored in the Buffer.

Implementations on Foreign Types§

Source§

impl<T> Buffer<T> for Vec<T>

Available on crate feature std only.
Source§

fn try_push(&mut self, item: T) -> Result<(), CapacityError<T>>

Source§

fn as_slice(&self) -> &[T]

Source§

impl<T, A: Array<Item = T>> Buffer<T> for ArrayVec<A>

Source§

fn try_push(&mut self, item: T) -> Result<(), CapacityError<T>>

Source§

fn as_slice(&self) -> &[T]

Implementors§