Trait checked_array::ArrayAllocPanic [−][src]
An infallible/panicking variant of ArrayAlloc
- Note: This trait adopts Rust’s “panic on allocation failure” policy. While this trait reintroduces a panic cause,
it’s usually much more convenient to use – especially for
std
-types which useWillPanic
anyway.
Required methods
fn alloc_new() -> Self
[src]
Creates a newly allocated instance of Self
fn alloc_clone<Source>(source: &Source) -> Self 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)
[src]
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) 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)
[src]
Shrinks self
to the given capacity if the current length is larger than len
fn push_front(&mut self, element: T)
[src]
Pushes an element
to the front of self
fn push_n_front<Source>(&mut self, elements: &Source) 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)
[src]
Pushes an element
to the front of self
fn push_n_back<Source>(&mut self, elements: &Source) 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) -> Option<T>
[src]
Pops an element
from the front of self
fn pop_n_front(&mut self, len: usize) -> Option<Self>
[src]
Pops multiple elements
from the front of self
fn pop_back(&mut self) -> Option<T>
[src]
Pops an element
from the back of self
fn pop_n_back(&mut self, len: usize) -> Option<Self>
[src]
Pops multiple elements
from the back of self
Implementors
impl<T, Array> ArrayAllocPanic<T> for Array where
Array: ArrayAlloc<T>,
[src]
Array: ArrayAlloc<T>,
fn alloc_new() -> Self
[src]
fn alloc_clone<Source>(elements: &Source) -> Self where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
fn grow_with(&mut self, len: usize, init: impl FnMut() -> T)
[src]
fn grow(&mut self, len: usize) where
T: Default,
[src]
T: Default,
fn shrink(&mut self, len: usize)
[src]
fn push_front(&mut self, element: T)
[src]
fn push_n_front<Source>(&mut self, elements: &Source) where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,
fn push_back(&mut self, element: T)
[src]
fn push_n_back<Source>(&mut self, elements: &Source) where
Source: ArrayRef<T>,
T: Clone,
[src]
Source: ArrayRef<T>,
T: Clone,