Trait Append

Source
pub trait Append: Sized + Clear {
    // Required method
    fn append(&mut self, val: &mut Self);
}
Expand description

A trait for moving data from one collection into another without freeing resources.

Conceptually, an append is equivalent to a push, with the caveat that the data is “moved out” of the pushed collection instead of being consumed. This allows reuse of the pushed collection’s resources.

Required Methods§

Source

fn append(&mut self, val: &mut Self)

Moves data out of val and into this collection.

Invoking this method should make val empty without freeing any resources. Any data that would be pushed out of self should be retained in val.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Append for String

Source§

fn append(&mut self, val: &mut Self)

Source§

impl Append for OsString

Source§

fn append(&mut self, val: &mut Self)

Source§

impl<K: Ord, V> Append for BTreeMap<K, V>

Source§

fn append(&mut self, val: &mut Self)

Source§

impl<T> Append for LinkedList<T>

Source§

fn append(&mut self, val: &mut Self)

Source§

impl<T> Append for VecDeque<T>

Source§

fn append(&mut self, val: &mut Self)

Source§

impl<T> Append for Vec<T>

Source§

fn append(&mut self, val: &mut Self)

Source§

impl<T: Ord> Append for BinaryHeap<T>

Source§

fn append(&mut self, val: &mut Self)

Source§

impl<T: Ord> Append for BTreeSet<T>

Source§

fn append(&mut self, val: &mut Self)

Implementors§