Trait slice_queue::ReadableSliceQueue [−][src]
pub trait ReadableSliceQueue<T> {
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
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
fn len(&self) -> usize
The amount of elements stored
Returns the amount of elements stored in self
fn is_empty(&self) -> bool
Checks if there are no elements stored
Returns either true if self is empty or false otherwise
fn pop(&mut self) -> Result<T, ()>
Consumes the first element and returns it
Returns either Ok(element) if there was an element to consume or Err(())
otherwise
fn pop_n(&mut self, n: usize) -> Result<Vec<T>, Vec<T>>
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
fn pop_into(&mut self, dst: &mut [T]) -> Result<(), usize>
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
fn drop_n(&mut self, n: usize) -> Result<(), usize>
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
impl<T> ReadableSliceQueue<T> for SliceQueue<T>