TryPush

Trait TryPush 

Source
pub trait TryPush<T> {
    // Required methods
    fn try_push(&mut self, elem: T) -> Element<T>;
    fn try_push_front(&mut self, elem: T) -> Element<T>;
}

Required Methods§

Source

fn try_push(&mut self, elem: T) -> Element<T>

Attempts to push an element to the collection. If that action would re-allocate or require shifting elements then the elem is returned in Element::NotAdded(). Otherwise, the return value is Element::Added.

Source

fn try_push_front(&mut self, elem: T) -> Element<T>

Attempts to push an element front to the collection. If that action would re-allocate or require shifting elements then the elem is returned in Element::NotAdded(). Otherwise, the return value is Element::Added.

Implementations on Foreign Types§

Source§

impl<T> TryPush<T> for VecDeque<T>

Source§

fn try_push(&mut self, elem: T) -> Element<T>

Source§

fn try_push_front(&mut self, elem: T) -> Element<T>

Source§

impl<T> TryPush<T> for Vec<T>

Source§

fn try_push(&mut self, elem: T) -> Element<T>

Source§

fn try_push_front(&mut self, elem: T) -> Element<T>

Implementors§