pub struct PackedArray<T, const N: usize> { /* private fields */ }
Expand description
Densly packed data structure for fast iteration
Implementations§
Source§impl<T, const N: usize> PackedArray<T, N>
impl<T, const N: usize> PackedArray<T, N>
Sourcepub fn full(&self) -> bool
pub fn full(&self) -> bool
Returns true if allocated memory is exhausted True also means that no more entries can be added
Sourcepub fn get(&self, index: usize) -> &T
pub fn get(&self, index: usize) -> &T
Returns reference to an element at index Panics if there is no valid element with such index
Sourcepub fn get_mut(&mut self, index: usize) -> &mut T
pub fn get_mut(&mut self, index: usize) -> &mut T
Return mutable reference to an element at index Panics if there is no valid element with such index
Sourcepub fn append(&mut self, value: T) -> usize
pub fn append(&mut self, value: T) -> usize
Adds element to the end of array. Return index of newly-added element for future access Panics if structure is full
Sourcepub fn set(&mut self, index: usize, value: T)
pub fn set(&mut self, index: usize, value: T)
Sets value of passed index If there is no valid element with such index, element is added
Sourcepub fn remove(&mut self, index: usize)
pub fn remove(&mut self, index: usize)
Removes element by given index Panics if there is no valid element with such index
Sourcepub fn as_slice_mut(&mut self) -> &mut [T]
pub fn as_slice_mut(&mut self) -> &mut [T]
Returns an underlying storage as mutable slice
Trait Implementations§
Auto Trait Implementations§
impl<T, const N: usize> Freeze for PackedArray<T, N>
impl<T, const N: usize> RefUnwindSafe for PackedArray<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> !Send for PackedArray<T, N>
impl<T, const N: usize> !Sync for PackedArray<T, N>
impl<T, const N: usize> Unpin for PackedArray<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for PackedArray<T, N>where
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more