pub trait Push<T>: CanPush<T> {
// Required method
fn push(&mut self, val: T) -> Option<Self::PushedOut>;
}Expand description
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.