pub trait PushSorted<T>: CanPush<T> {
// Required method
fn push_sorted(&mut self, val: T) -> Option<Self::PushedOut>;
}
Expand description
A trait for moving data into a collection while retaining a sorted invariant.
Unlike Push
, sorted pushes must take a logarithmic amount of time and space with respect to
the length of the collection.
Required Methods§
Sourcefn push_sorted(&mut self, val: T) -> Option<Self::PushedOut>
fn push_sorted(&mut self, val: T) -> Option<Self::PushedOut>
Moves the value into the collection, yielding the value that was pushed out, if any.
This method should retain some sort of sorting invariant within the collection.