pub fn swap_remove(&mut self, index: usize) -> Option<T> {
        if index >= self.len {
            return None;
        }

        // pop can't fail -- since index is in [0, len), len must be at least one
        let last = self.pop().unwrap();

        if index == self.len {
            return Some(last);
        }

        Some(mem::replace(&mut self.body[index], last))
    }
/// Remove an element at `index` if it exists by replacing it with the last
/// element of the vector.
Remove an element at `index` if it exists by replacing it with the last
element of the vector.
Remove an element at ` index ` if it exists by replacing it with the last element of the vector .
pub fn swap_remove(&mut self, index: usize) -> Option<T> {
        if index >= self.len {
            return None;
        }
        // pop can't fail -- since index is in [0, len), len must be at least one
        let last = self.pop().unwrap();
        if index == self.len {
            return Some(last);
        }
        Some(mem::replace(&mut self.body[index], last))
    }
pub fn swap_remove ( & mut self , index : usize ) -> Option < T > { if index >= self . len { return None ; } // pop can't fail -- since index is in [0, len), len must be at least one let last = self . pop ( ) . unwrap ( ) ; if index == self . len { return Some ( last ) ; } Some ( mem :: replace ( & mut self . body [ index ] , last ) ) }
Remove an element at `index` if it exists by replacing it with the last
element of the vector.
Remove an element at ` index ` if it exists by replacing it with the last element of the vector .
&mut self
index
usize