Trait push_trait::base::Push
[−]
[src]
pub trait Push<T>: CanPush<T> { fn push(&mut self, val: T) -> Option<Self::PushedOut>; }
A trait for moving data into a collection.
Some containers have limitations on which elements can be stored at once; these collections will "push out" a value after the push happens. A finite-size buffer may push out the oldest value, or a map may push out a value at the same key.
Pushing an item must take a linear amount of time and space with respect to the length of the pushed item. References can be pushed to "copy" data.
Required Methods
fn push(&mut self, val: T) -> Option<Self::PushedOut>
Moves the value into the collection, yielding the value that was pushed out, if any.
Implementors
impl<T: Append> Push<T> for T
impl<T> Push<T> for LinkedList<T>
impl Push<char> for String
impl<'a> Push<&'a str> for String
impl<T> Push<T> for Vec<T>
impl Push<char> for Vec<u8>
impl Push<char> for Vec<u16>
impl Push<char> for Vec<u32>
impl<'a, T: 'a + Clone> Push<&'a [T]> for Vec<T>
impl<T> Push<T> for VecDeque<T>
impl<'a> Push<&'a OsStr> for OsString
impl<'a> Push<&'a str> for OsString
impl<K: Hash + Eq, V> Push<(K, V)> for HashMap<K, V>
impl<T: Hash + Eq> Push<T> for HashSet<T>