[−][src]Struct heaparray::base::ThinPtrArray
Heap-allocated array, with array size stored alongside the memory block itself.
Examples
Creating an array:
use heaparray::base::*; let len = 10; let array = ThinPtrArray::new(len, |idx| idx + 3);
Indexing works as you would expect:
array[3] = 2; assert!(array[3] == 2);
Additionally, you can customize what information should be stored alongside the elements in
the array using the ThinPtrArray::with_label
function:
struct MyLabel { pub even: usize, pub odd: usize, } let mut array = ThinPtrArray::with_label( MyLabel { even: 0, odd: 0 }, 100, |label, index| { if index % 2 == 0 { label.even += 1; index } else { label.odd += 1; index } });
Trait Implementations
impl<E, L> BaseArrayRef for ThinPtrArray<E, L>
[src]
impl<E, L> LabelledArray<E, L> for ThinPtrArray<E, L>
[src]
fn with_label<F>(label: L, len: usize, func: F) -> Self where
F: FnMut(&mut L, usize) -> E,
[src]
F: FnMut(&mut L, usize) -> E,
unsafe fn with_label_unsafe(label: L, len: usize) -> Self
[src]
fn get_label(&self) -> &L
[src]
unsafe fn get_label_unsafe(&self) -> &mut L
[src]
unsafe fn get_unsafe(&self, idx: usize) -> &mut E
[src]
impl<E, L> LabelledArrayMut<E, L> for ThinPtrArray<E, L>
[src]
fn get_label_mut(&mut self) -> &mut L
[src]
impl<E, L> DefaultLabelledArray<E, L> for ThinPtrArray<E, L> where
E: Default,
[src]
E: Default,
impl<E> MakeArray<E> for ThinPtrArray<E, ()>
[src]
impl<E, L> SliceArray<E> for ThinPtrArray<E, L>
[src]
impl<E, L> Clone for ThinPtrArray<E, L> where
E: Clone,
L: Clone,
[src]
E: Clone,
L: Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
[src]
impl<E, L> Drop for ThinPtrArray<E, L>
[src]
impl<E, L> IntoIterator for ThinPtrArray<E, L>
[src]
type Item = E
The type of the elements being iterated over.
type IntoIter = ThinPtrArrayIter<E, L>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'b, E, L> IntoIterator for &'b ThinPtrArray<E, L>
[src]
type Item = &'b E
The type of the elements being iterated over.
type IntoIter = Iter<'b, E>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'b, E, L> IntoIterator for &'b mut ThinPtrArray<E, L>
[src]
type Item = &'b mut E
The type of the elements being iterated over.
type IntoIter = IterMut<'b, E>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<E, L> Sync for ThinPtrArray<E, L> where
E: Sync,
L: Sync,
[src]
E: Sync,
L: Sync,
impl<E, L> Send for ThinPtrArray<E, L> where
E: Send,
L: Send,
[src]
E: Send,
L: Send,
impl<E, L> Debug for ThinPtrArray<E, L> where
E: Debug,
L: Debug,
[src]
E: Debug,
L: Debug,
impl<E, L> Index<usize> for ThinPtrArray<E, L>
[src]
impl<E, L> IndexMut<usize> for ThinPtrArray<E, L>
[src]
impl<E, L> Container for ThinPtrArray<E, L>
[src]
impl<E, L> CopyMap<usize, E> for ThinPtrArray<E, L>
[src]
Blanket Implementations
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[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> 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> 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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,