pub struct RingBuf<T> { priv nelts: uint, priv lo: uint, priv elts: ~[std::option::Option], }
RingBuf is a circular buffer that implements Deque.
impl<T> RingBuf<T>
fn new() -> RingBuf<T>
Create an empty RingBuf
fn with_capacity(n: uint) -> RingBuf<T>
Create an empty RingBuf with space for at least n
elements.
fn get<'a>(&'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<'a>(&'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 reserve(&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
fn reserve_at_least(&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.
fn iter<'a>(&'a self) -> RingBufIterator<'a, T>
Front-to-back iterator.
fn rev_iter<'a>(&'a self) -> std::iter::Invert
Back-to-front iterator.
fn mut_iter<'a>(&'a mut self) -> RingBufMutIterator<'a, T>
Front-to-back iterator which returns mutable values.
fn mut_rev_iter<'a>(&'a mut self) -> std::iter::Invert
Back-to-front iterator which returns mutable values.
impl<T: std::clone::Clone> std::clone::Clone for RingBuf<T>
fn clone(&self) -> RingBuf<T>
impl<T> std::container::Container for RingBuf<T>
fn len(&self) -> uint
Return the number of elements in the RingBuf
impl<T> std::container::Mutable for RingBuf<T>
fn clear(&mut self)
Clear the RingBuf, removing all values.
impl<T> Deque<T> for RingBuf<T>
fn front<'a>(&'a self) -> std::option::Option
Return a reference to the first element in the RingBuf
fn front_mut<'a>(&'a mut self) -> std::option::Option
Return a mutable reference to the first element in the RingBuf
fn back<'a>(&'a self) -> std::option::Option
Return a reference to the last element in the RingBuf
fn back_mut<'a>(&'a mut self) -> std::option::Option
Return a mutable reference to the last element in the RingBuf
fn pop_front(&mut self) -> std::option::Option
Remove and return the first element in the RingBuf, or None if it is empty
fn pop_back(&mut self) -> std::option::Option
Remove and return the last element in the RingBuf, or None if it is empty
fn push_front(&mut self, t: T)
Prepend an element to the RingBuf
fn push_back(&mut self, t: T)
Append an element to the RingBuf
impl<A: std::cmp::Eq> std::cmp::Eq for RingBuf<A>
impl<A> std::iter::FromIterator for RingBuf<A>
fn from_iterator<T: std::iter::Iterator>(iterator: &mut T) -> RingBuf<A>
impl<A> std::iter::Extendable for RingBuf<A>
fn extend<T: std::iter::Iterator>(&mut self, iterator: &mut T)
impl<S: Encoder, T: Encodable<S>> Encodable<S> for RingBuf<T>
fn encode(&self, s: &mut S)
impl<D: Decoder, T: Decodable<D>> Decodable<D> for RingBuf<T>
fn decode(d: &mut D) -> RingBuf<T>
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).