Trait slice_queue::ReadableSliceQueue[][src]

pub trait ReadableSliceQueue<T> {
    fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn peek(&self) -> Option<&T>;
fn peek_n(&self, n: usize) -> Result<&[T], &[T]>;
fn pop(&mut self) -> Result<T, ()>;
fn pop_n(&mut self, n: usize) -> Result<Vec<T>, Vec<T>>;
fn pop_into(&mut self, dst: &mut [T]) -> Result<(), usize>;
fn drop_n(&mut self, n: usize) -> Result<(), usize>; }

Required Methods

The amount of elements stored

Returns the amount of elements stored in self

Checks if there are no elements stored

Returns either true if self is empty or false otherwise

Take a look at the first element without consuming it

Returns either Some(element_ref) if we have a first element or None otherwise

Take a look at the first n elements without consuming them

Parameters:

  • n: The amount of elements to peek at

Returns either Ok(element_refs) if there were n elements avaliable to peek at or Err(element_refs) if less elements were available

Consumes the first element and returns it

Returns either Ok(element) if there was an element to consume or Err(()) otherwise

Consumes the first n elements and returns them

Parameters:

  • n: The amount of elements to consume

Returns either Ok(elements) if there were n elements avaliable to consume or Err(elements) if less elements were available

Consumes the first dst.len() and moves them into dst

Parameters:

  • dst: The target to move the elements into

Returns either Ok(()) if dst was filled completely or Err(element_count) if only element_count elements were moved

Discards the first n elements

Parameters:

  • n: The amount of elements to discard

Returns either Ok(()) if n elements were discarded or Err(element_count) if only element_count elements were discarded

Implementors