pub struct Array<Wrapped> { /* private fields */ }
Expand description
A wrapper for array types that exposes checked APIs only
Implementations§
Trait Implementations§
Source§impl<T, Wrapped> ArrayAlloc<T> for Array<Wrapped>
impl<T, Wrapped> ArrayAlloc<T> for Array<Wrapped>
Source§fn alloc_clone<Source>(elements: &Source) -> Result<Self, Self::Error>
fn alloc_clone<Source>(elements: &Source) -> Result<Self, Self::Error>
Clones
source
into a newly allocated instance of Self
Source§fn grow_with(
&mut self,
len: usize,
init: impl FnMut() -> T,
) -> Result<(), Self::Error>
fn grow_with( &mut self, len: usize, init: impl FnMut() -> T, ) -> Result<(), Self::Error>
Grows
self
to the given capacity if the current length is smaller than len
and inits new elements using init
Source§fn grow(&mut self, len: usize) -> Result<(), Self::Error>where
T: Default,
fn grow(&mut self, len: usize) -> Result<(), Self::Error>where
T: Default,
Grows
self
to the given capacity if the current length is smaller than len
and inits new elements using
Default
Source§fn shrink(&mut self, len: usize) -> Result<(), Self::Error>
fn shrink(&mut self, len: usize) -> Result<(), Self::Error>
Shrinks
self
to the given capacity if the current length is larger than len
Source§fn push_front(&mut self, element: T) -> Result<(), Self::Error>
fn push_front(&mut self, element: T) -> Result<(), Self::Error>
Pushes an
element
to the front of self
Source§fn push_n_front<Source>(&mut self, elements: &Source) -> Result<(), Self::Error>
fn push_n_front<Source>(&mut self, elements: &Source) -> Result<(), Self::Error>
Pushes some
elements
to the front of self
Source§fn push_back(&mut self, element: T) -> Result<(), Self::Error>
fn push_back(&mut self, element: T) -> Result<(), Self::Error>
Pushes an
element
to the front of self
Source§fn push_n_back<Source>(&mut self, elements: &Source) -> Result<(), Self::Error>
fn push_n_back<Source>(&mut self, elements: &Source) -> Result<(), Self::Error>
Pushes some
elements
to the front of self
Source§fn pop_front(&mut self) -> Result<Option<T>, Self::Error>
fn pop_front(&mut self) -> Result<Option<T>, Self::Error>
Pops an
element
from the front of self
Source§fn pop_n_front(&mut self, len: usize) -> Result<Option<Self>, Self::Error>
fn pop_n_front(&mut self, len: usize) -> Result<Option<Self>, Self::Error>
Pops multiple
elements
from the front of self
Source§impl<T, Wrapped> ArrayMut<T> for Array<Wrapped>
impl<T, Wrapped> ArrayMut<T> for Array<Wrapped>
Source§fn as_slice_mut(&mut self) -> &mut [T]
fn as_slice_mut(&mut self) -> &mut [T]
The underlying element as mutable slice
Source§fn get_n_mut<Range>(&mut self, range: Range) -> Option<Array<&mut [T]>>where
Range: RangeBounds<usize>,
fn get_n_mut<Range>(&mut self, range: Range) -> Option<Array<&mut [T]>>where
Range: RangeBounds<usize>,
Gets a mutable subrange
Source§fn iter_mut(&mut self) -> SliceIterMut<'_, T> ⓘ
fn iter_mut(&mut self) -> SliceIterMut<'_, T> ⓘ
Returns an iterator that mutably references the elements
Source§fn rotate_left(&mut self, count: usize)
fn rotate_left(&mut self, count: usize)
Rotates the elements left by
count
fieldsSource§fn rotate_right(&mut self, count: usize)
fn rotate_right(&mut self, count: usize)
Rotates the elements right by
count
fieldsSource§impl<T, Wrapped> ArrayRef<T> for Array<Wrapped>
impl<T, Wrapped> ArrayRef<T> for Array<Wrapped>
Source§fn get_n<Range>(&self, range: Range) -> Option<Array<&[T]>>where
Range: RangeBounds<usize>,
fn get_n<Range>(&self, range: Range) -> Option<Array<&[T]>>where
Range: RangeBounds<usize>,
Gets a subrange
Source§fn clone_to<Source>(&self, dest: &mut Source) -> Result<(), BufferTooSmall>
fn clone_to<Source>(&self, dest: &mut Source) -> Result<(), BufferTooSmall>
Clones
self
to target
Source§impl<Wrapped> IntoIterator for Array<Wrapped>where
Wrapped: IntoIterator,
impl<Wrapped> IntoIterator for Array<Wrapped>where
Wrapped: IntoIterator,
Source§impl<Wrapped> Ord for Array<Wrapped>where
Wrapped: Ord,
impl<Wrapped> Ord for Array<Wrapped>where
Wrapped: Ord,
Source§impl<Wrapped> PartialOrd for Array<Wrapped>where
Wrapped: PartialOrd,
impl<Wrapped> PartialOrd for Array<Wrapped>where
Wrapped: PartialOrd,
impl<Wrapped> Copy for Array<Wrapped>where
Wrapped: Copy,
impl<Wrapped> Eq for Array<Wrapped>where
Wrapped: Eq,
Auto Trait Implementations§
impl<Wrapped> Freeze for Array<Wrapped>where
Wrapped: Freeze,
impl<Wrapped> RefUnwindSafe for Array<Wrapped>where
Wrapped: RefUnwindSafe,
impl<Wrapped> Send for Array<Wrapped>where
Wrapped: Send,
impl<Wrapped> Sync for Array<Wrapped>where
Wrapped: Sync,
impl<Wrapped> Unpin for Array<Wrapped>where
Wrapped: Unpin,
impl<Wrapped> UnwindSafe for Array<Wrapped>where
Wrapped: UnwindSafe,
Blanket Implementations§
Source§impl<T, Array> ArrayAllocPanic<T> for Arraywhere
Array: ArrayAlloc<T>,
impl<T, Array> ArrayAllocPanic<T> for Arraywhere
Array: ArrayAlloc<T>,
Source§fn alloc_clone<Source>(elements: &Source) -> Array
fn alloc_clone<Source>(elements: &Source) -> Array
Clones
source
into a newly allocated instance of Self
Source§fn grow_with(&mut self, len: usize, init: impl FnMut() -> T)
fn grow_with(&mut self, len: usize, init: impl FnMut() -> T)
Grows
self
to the given capacity if the current length is smaller than len
and inits new elements using init
Source§fn grow(&mut self, len: usize)where
T: Default,
fn grow(&mut self, len: usize)where
T: Default,
Grows
self
to the given capacity if the current length is smaller than len
and inits new elements using
Default
Source§fn shrink(&mut self, len: usize)
fn shrink(&mut self, len: usize)
Shrinks
self
to the given capacity if the current length is larger than len
Source§fn push_front(&mut self, element: T)
fn push_front(&mut self, element: T)
Pushes an
element
to the front of self
Source§fn push_n_front<Source>(&mut self, elements: &Source)
fn push_n_front<Source>(&mut self, elements: &Source)
Pushes some
elements
to the front of self
Source§fn push_n_back<Source>(&mut self, elements: &Source)
fn push_n_back<Source>(&mut self, elements: &Source)
Pushes some
elements
to the front of self
Source§fn pop_n_front(&mut self, len: usize) -> Option<Array>
fn pop_n_front(&mut self, len: usize) -> Option<Array>
Pops multiple
elements
from the front of self
Source§fn pop_n_back(&mut self, len: usize) -> Option<Array>
fn pop_n_back(&mut self, len: usize) -> Option<Array>
Pops multiple
elements
from the back of self
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