[−][src]Struct rate_common::memory::Array
A contiguous non-growable array type with strongly-typed indexing.
The first template argument specifies the type that can be used for indexing the array. The second template argument specifies the type of the elements in the array.
An Array can be used as a fixed size map or set data structure.
The maximum index must be set at construction time, which will allocate
an area of memory of that size. As a result, this can be quite memory-consuming
for sparse maps or sets, but it is as efficient as it gets for fast lookups.
Fields
data: Vector<T>The vector of elements
phantom: PhantomData<I>Zero-sized field to appease the compiler, since I is not used in any other field
Methods
impl<I: Offset, T: Clone> Array<I, T>[src]
pub fn new(value: T, size: usize) -> Array<I, T>[src]
Create a new array of size size with all elements set to value.
impl<I: Offset, T> Array<I, T>[src]
pub fn with_capacity(size: usize) -> Array<I, T>[src]
Create a new array of size size without initializing its elements.
pub fn from(data: Vector<T>) -> Array<I, T>[src]
Create a new array by taking ownership of a Vector.
pub fn size(&self) -> usize[src]
Returns the size of the array.
Trait Implementations
impl<I: Offset, T: HeapSpace> HeapSpace for Array<I, T>[src]
fn heap_space(&self) -> usize[src]
impl<I: Eq + Offset, T: Eq> Eq for Array<I, T>[src]
impl<I: Offset, T> AsMut<Array<I, T>> for Array<I, T>[src]
impl<I: Offset, T> AsMut<[T]> for Array<I, T>[src]
impl<I: Offset, T> Default for Array<I, T>[src]
impl<I: Clone + Offset, T: Clone> Clone for Array<I, T>[src]
impl<I: Offset, T> AsRef<Array<I, T>> for Array<I, T>[src]
impl<I: Offset, T> AsRef<[T]> for Array<I, T>[src]
impl<I: PartialEq + Offset, T: PartialEq> PartialEq<Array<I, T>> for Array<I, T>[src]
impl<I: Offset, T> Deref for Array<I, T>[src]
impl<I: Offset, T> DerefMut for Array<I, T>[src]
impl<I: Offset, T> Index<I> for Array<I, T>[src]
impl<I: Offset, T> IndexMut<I> for Array<I, T>[src]
impl<I: Debug + Offset, T: Debug> Debug for Array<I, T>[src]
Auto Trait Implementations
impl<I, T> Send for Array<I, T> where
I: Send,
T: Send,
I: Send,
T: Send,
impl<I, T> Unpin for Array<I, T> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<I, T> Sync for Array<I, T> where
I: Sync,
T: Sync,
I: Sync,
T: Sync,
impl<I, T> UnwindSafe for Array<I, T> where
I: UnwindSafe,
T: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
impl<I, T> RefUnwindSafe for Array<I, T> where
I: RefUnwindSafe,
T: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> HeapSpace for T where
T: Copy, [src]
T: Copy,
fn heap_space(&Self) -> usize[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,