extend_sorted

Function extend_sorted 

Source
pub fn extend_sorted<T, I, F>(
    vec: &mut Vec<T>,
    new_items: I,
    limit: usize,
    cmp: F,
)
where I: IntoIterator<Item = T>, F: FnMut(&T, &T) -> Ordering,
Expand description

Extend a sorted vector with a sorted sequence of items, maintaining the vector’s sort order and enforcing a maximum length. This also de-duplicates items. Sort the items according to the given callback. Before calling this, both vec and new_items should already be sorted according to the cmp comparator.