Trait checked_array::ArrayAlloc [−][src]
A trait for allocatable/resizeable linear array types
Associated Types
Loading content...Required methods
fn alloc_new() -> Result<Self, Self::Error>
[src]
Creates a newly allocated instance of Self
fn alloc_clone<Source>(source: &Source) -> Result<Self, Self::Error> where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
Clones source
into a newly allocated instance of Self
fn grow_with(
&mut self,
len: usize,
init: impl FnMut() -> T
) -> Result<(), Self::Error>
[src]
&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
fn grow(&mut self, len: usize) -> Result<(), Self::Error> where
T: Default,
[src]
T: Default,
Grows self
to the given capacity if the current length is smaller than len
and inits new elements using
Default
fn shrink(&mut self, len: usize) -> Result<(), Self::Error>
[src]
Shrinks self
to the given capacity if the current length is larger than len
fn push_front(&mut self, element: T) -> Result<(), Self::Error>
[src]
Pushes an element
to the front of self
fn push_n_front<Source>(&mut self, elements: &Source) -> Result<(), Self::Error> where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
Pushes some elements
to the front of self
fn push_back(&mut self, element: T) -> Result<(), Self::Error>
[src]
Pushes an element
to the front of self
fn push_n_back<Source>(&mut self, elements: &Source) -> Result<(), Self::Error> where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
Pushes some elements
to the front of self
fn pop_front(&mut self) -> Result<Option<T>, Self::Error>
[src]
Pops an element
from the front of self
fn pop_n_front(&mut self, len: usize) -> Result<Option<Self>, Self::Error>
[src]
Pops multiple elements
from the front of self
fn pop_back(&mut self) -> Result<Option<T>, Self::Error>
[src]
Pops an element
from the back of self
fn pop_n_back(&mut self, len: usize) -> Result<Option<Self>, Self::Error>
[src]
Pops multiple elements
from the back of self
Implementors
impl<T, Wrapped> ArrayAlloc<T> for Array<Wrapped> where
Wrapped: AsRef<[T]> + AsMut<[T]> + CanAlloc<T>,
[src]
Wrapped: AsRef<[T]> + AsMut<[T]> + CanAlloc<T>,
type Error = Wrapped::Error
fn alloc_new() -> Result<Self, Self::Error>
[src]
fn alloc_clone<Source>(elements: &Source) -> Result<Self, Self::Error> where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
fn grow_with(
&mut self,
len: usize,
init: impl FnMut() -> T
) -> Result<(), Self::Error>
[src]
&mut self,
len: usize,
init: impl FnMut() -> T
) -> Result<(), Self::Error>
fn grow(&mut self, len: usize) -> Result<(), Self::Error> where
T: Default,
[src]
T: Default,
fn shrink(&mut self, len: usize) -> Result<(), Self::Error>
[src]
fn push_front(&mut self, element: T) -> Result<(), Self::Error>
[src]
fn push_n_front<Source>(&mut self, elements: &Source) -> Result<(), Self::Error> where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
fn push_back(&mut self, element: T) -> Result<(), Self::Error>
[src]
fn push_n_back<Source>(&mut self, elements: &Source) -> Result<(), Self::Error> where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,