Struct std::collections::RingBuf[src]

pub struct RingBuf<T> {
    // some fields omitted
}

RingBuf is a circular buffer that implements Deque.

Methods

impl<T> RingBuf<T>

fn new<T>() -> RingBuf<T>

Create an empty RingBuf

fn with_capacity<T>(n: uint) -> RingBuf<T>

Create an empty RingBuf with space for at least n elements.

fn get<T>(&'a self, i: uint) -> &'a T

Retrieve an element in the RingBuf by index

Fails if there is no element with the given index

fn get_mut<T>(&'a mut self, i: uint) -> &'a mut T

Retrieve an element in the RingBuf by index

Fails if there is no element with the given index

fn swap<T>(&mut self, i: uint, j: uint)

Swap elements at indices i and j

i and j may be equal.

Fails if there is no element with the given index

fn reserve_exact<T>(&mut self, n: uint)

Reserve capacity for exactly n elements in the given RingBuf, doing nothing if self's capacity is already equal to or greater than the requested capacity

Arguments

  • n - The number of elements to reserve space for

fn reserve<T>(&mut self, n: uint)

Reserve capacity for at least n elements in the given RingBuf, over-allocating in case the caller needs to reserve additional space.

Do nothing if self's capacity is already equal to or greater than the requested capacity.

Arguments

  • n - The number of elements to reserve space for

fn iter<T>(&'a self) -> Items<'a, T>

Front-to-back iterator.

fn mut_iter<T>(&'a mut self) -> MutItems<'a, T>

Front-to-back iterator which returns mutable values.

Trait Implementations

impl<T> Collection for RingBuf<T>

fn len<T>(&self) -> uint

Return the number of elements in the RingBuf

fn is_empty<T>(&self) -> bool

impl<T> Mutable for RingBuf<T>

fn clear<T>(&mut self)

Clear the RingBuf, removing all values.

impl<T> Deque<T> for RingBuf<T>

fn front<T>(&'a self) -> Option<&'a T>

Return a reference to the first element in the RingBuf

fn front_mut<T>(&'a mut self) -> Option<&'a mut T>

Return a mutable reference to the first element in the RingBuf

fn back<T>(&'a self) -> Option<&'a T>

Return a reference to the last element in the RingBuf

fn back_mut<T>(&'a mut self) -> Option<&'a mut T>

Return a mutable reference to the last element in the RingBuf

fn pop_front<T>(&mut self) -> Option<T>

Remove and return the first element in the RingBuf, or None if it is empty

fn pop_back<T>(&mut self) -> Option<T>

Remove and return the last element in the RingBuf, or None if it is empty

fn push_front<T>(&mut self, t: T)

Prepend an element to the RingBuf

fn push_back<T>(&mut self, t: T)

Append an element to the RingBuf

impl<T> Default for RingBuf<T>

fn default<T>() -> RingBuf<T>

impl<A: PartialEq> PartialEq for RingBuf<A>

fn eq<A: PartialEq>(&self, other: &RingBuf<A>) -> bool

fn ne<A: PartialEq>(&self, other: &RingBuf<A>) -> bool

fn ne<A: PartialEq>(&self, &RingBuf<A>) -> bool

impl<A> FromIterator<A> for RingBuf<A>

fn from_iter<T: Iterator<A>>(iterator: T) -> RingBuf<A>

impl<A> Extendable<A> for RingBuf<A>

fn extend<T: Iterator<A>>(&mut self, iterator: T)

impl<T: Show> Show for RingBuf<T>

fn fmt<T: Show>(&self, f: &mut Formatter) -> Result<(), FormatError>

Derived Implementations

impl<T: Clone> Clone for RingBuf<T>

fn clone<T: Clone>(&self) -> RingBuf<T>

fn clone_from<T: Clone>(&mut self, &RingBuf<T>)