pub fn replace(&mut self, element: A::Item) -> Option<A::Item> {
        match self.find(&element) {
            Ok(idx) => Some(replace(&mut self.vec[idx], element)),
            Err(idx) => {
                self.vec.insert(idx, element);
                None
            }
        }
    }
/// Adds a element to the set, replacing the existing element, if any, that is equal to the given
/// one. Returns the replaced element.
///
/// # Examples
///
/// ```
/// use small_ord_set::SmallOrdSet;
///
/// let mut set = SmallOrdSet::<[u32; 4]>::new();
///
/// assert_eq!(set.replace(2), None);
/// assert_eq!(set.replace(2), Some(2));
/// assert_eq!(set.len(), 1);
/// ```
Adds a element to the set, replacing the existing element, if any, that is equal to the given
one. Returns the replaced element.
Adds a element to the set replacing the existing element if any that is equal to the given one . Returns the replaced element .
pub fn replace(&mut self, element: A::Item) -> Option<A::Item> {
        match self.find(&element) {
            Ok(idx) => Some(replace(&mut self.vec[idx], element)),
            Err(idx) => {
                self.vec.insert(idx, element);
                None
            }
        }
    }
pub fn replace ( & mut self , element : A :: Item ) -> Option < A :: Item > { match self . find ( & element ) { Ok ( idx ) => Some ( replace ( & mut self . vec [ idx ] , element ) ) , Err ( idx ) => { self . vec . insert ( idx , element ) ; None } } }
Adds a element to the set, replacing the existing element, if any, that is equal to the given
one.
Adds a element to the set replacing the existing element if any that is equal to the given one .
&mut self
element
A::Item
&mut self
element
A::Item
examples
```
use small_ord_set::SmallOrdSet.




` ` ` use small_ord_set :: SmallOrdSet .