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§
Sourcefn try_push(&mut self, elem: T) -> Element<T>
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
.
Sourcefn try_push_front(&mut self, elem: T) -> Element<T>
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
.