Trait checked_array::ArrayAllocPanic[][src]

pub trait ArrayAllocPanic<T>: ArrayMut<T> + Sized {
    fn alloc_new() -> Self;
fn alloc_clone<Source>(source: &Source) -> Self
    where
        Source: ArrayRef<T>,
        T: Clone
;
fn grow_with(&mut self, len: usize, init: impl FnMut() -> T);
fn grow(&mut self, len: usize)
    where
        T: Default
;
fn shrink(&mut self, len: usize);
fn push_front(&mut self, element: T);
fn push_n_front<Source>(&mut self, elements: &Source)
    where
        Source: ArrayRef<T>,
        T: Clone
;
fn push_back(&mut self, element: T);
fn push_n_back<Source>(&mut self, elements: &Source)
    where
        Source: ArrayRef<T>,
        T: Clone
;
fn pop_front(&mut self) -> Option<T>;
fn pop_n_front(&mut self, len: usize) -> Option<Self>;
fn pop_back(&mut self) -> Option<T>;
fn pop_n_back(&mut self, len: usize) -> Option<Self>; }

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 use WillPanic 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]

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]

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]

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]

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

Loading content...

Implementors

impl<T, Array> ArrayAllocPanic<T> for Array where
    Array: ArrayAlloc<T>, 
[src]

Loading content...