pub fn insert_or_replace_sorted(&mut self, val: T) -> Option<T> {
        match self.body.binary_search(&val) {
            Ok(i) => Some(mem::replace(&mut self.body[i], val)),
            Err(i) => {
                self.insert(i, val);
                None
            }
        }
    }
/// Assuming the vector is sorted, insert the given value into its sorted position
/// if it does not already exist in the vector.
/// If an element already exists that compares equal to `val`, reaplce it with
/// `val` and return its original value.
/// Behavior is undefined if the vector is not sorted.
Assuming the vector is sorted, insert the given value into its sorted position
if it does not already exist in the vector.
If an element already exists that compares equal to `val`, reaplce it with
`val` and return its original value.
Behavior is undefined if the vector is not sorted.
Assuming the vector is sorted insert the given value into its sorted position if it does not already exist in the vector . If an element already exists that compares equal to ` val ` reaplce it with ` val ` and return its original value . Behavior is undefined if the vector is not sorted .
pub fn insert_or_replace_sorted(&mut self, val: T) -> Option<T> {
        match self.body.binary_search(&val) {
            Ok(i) => Some(mem::replace(&mut self.body[i], val)),
            Err(i) => {
                self.insert(i, val);
                None
            }
        }
    }
pub fn insert_or_replace_sorted ( & mut self , val : T ) -> Option < T > { match self . body . binary_search ( & val ) { Ok ( i ) => Some ( mem :: replace ( & mut self . body [ i ] , val ) ) , Err ( i ) => { self . insert ( i , val ) ; None } } }
Assuming the vector is sorted, insert the given value into its sorted position
if it does not already exist in the vector.
Assuming the vector is sorted insert the given value into its sorted position if it does not already exist in the vector .
&mut self
val
T