[][src]Struct rate_common::memory::BoundedVector

pub struct BoundedVector<T> where
    T: HeapSpace
{ /* fields omitted */ }

A contiguous but non-growable array type, using Vector

This exposes a subset of the Vector API (and thus essentially behaves like a std::vec::Vec). Notably, it does not provide functions that grow the capacity of the vector.

A BoundedVector can be used as a stack with a known maximum size.

Methods

impl<T: HeapSpace> BoundedVector<T>[src]

pub fn with_capacity(capacity: usize) -> BoundedVector<T>[src]

pub fn push(&mut self, value: T)[src]

Pushes a value, increasing the vector's length by one.

Note that unlike [Vec::push()`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.push) this does not grow the vector if it is full.

Panics

Panics if there is no space for the new element.

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

pub fn capacity(&self) -> usize[src]

pub fn pop(&mut self) -> Option<T>[src]

pub fn first(&self) -> &T[src]

pub fn last(&self) -> &T[src]

pub fn iter(&self) -> Iter<T>[src]

pub fn as_ptr(&mut self) -> *const T[src]

pub fn mut_ptr(&mut self) -> *mut T[src]

pub fn truncate(&mut self, new_length: usize)[src]

pub fn clear(&mut self)[src]

impl<T: HeapSpace + Clone + Default> BoundedVector<T>[src]

pub fn resize(&mut self, new_length: usize)[src]

impl<T: HeapSpace + Ord> BoundedVector<T>[src]

impl<T: HeapSpace> BoundedVector<T>[src]

pub fn sort_unstable_by_key<F, K>(&mut self, f: F) where
    F: FnMut(&T) -> K,
    K: Ord
[src]

Trait Implementations

impl<T> HeapSpace for BoundedVector<T> where
    T: HeapSpace
[src]

impl<T: Default> Default for BoundedVector<T> where
    T: HeapSpace
[src]

impl<T: Clone> Clone for BoundedVector<T> where
    T: HeapSpace
[src]

impl<T: PartialEq> PartialEq<BoundedVector<T>> for BoundedVector<T> where
    T: HeapSpace
[src]

impl<'a, T: HeapSpace> IntoIterator for &'a BoundedVector<T>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?

impl<T: HeapSpace> Index<usize> for BoundedVector<T>[src]

type Output = T

The returned type after indexing.

impl<T: HeapSpace> IndexMut<usize> for BoundedVector<T>[src]

impl<T: Debug> Debug for BoundedVector<T> where
    T: HeapSpace
[src]

Auto Trait Implementations

impl<T> Send for BoundedVector<T> where
    T: Send

impl<T> Unpin for BoundedVector<T> where
    T: Unpin

impl<T> Sync for BoundedVector<T> where
    T: Sync

impl<T> UnwindSafe for BoundedVector<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for BoundedVector<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> HeapSpace for T where
    T: Copy
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]