pub fn remove(&mut self, i: Index) -> Option<T> {
        if i.index >= self.items.len() as u32 {
            return None;
        }

        match self.items[i.index as usize] {
            Entry::Occupied { generation, .. } if i.generation == generation => {
                let entry = mem::replace(
                    &mut self.items[i.index as usize],
                    Entry::Free {
                        next_free: self.free_list_head,
                    },
                );
                self.generation += 1;
                self.free_list_head = Some(i.index);
                self.len -= 1;

                match entry {
                    Entry::Occupied {
                        generation: _,
                        value,
                    } => Some(value),
                    _ => unreachable!(),
                }
            }
            _ => None,
        }
    }
/// Remove the element at index `i` from the arena.
///
/// If the element at index `i` is still in the arena, then it is
/// returned. If it is not in the arena, then `None` is returned.
///
/// # Examples
///
/// ```ignore
/// use rapier::data::arena::Arena;
///
/// let mut arena = Arena::new();
/// let idx = arena.insert(42);
///
/// assert_eq!(arena.remove(idx), Some(42));
/// assert_eq!(arena.remove(idx), None);
/// ```
Remove the element at index `i` from the arena.
If the element at index `i` is still in the arena, then it is
returned. If it is not in the arena, then `None` is returned.
Remove the element at index ` i ` from the arena . If the element at index ` i ` is still in the arena then it is returned . If it is not in the arena then ` None ` is returned .
pub fn remove(&mut self, i: Index) -> Option<T> {
        if i.index >= self.items.len() as u32 {
            return None;
        }
        match self.items[i.index as usize] {
            Entry::Occupied { generation, .. } if i.generation == generation => {
                let entry = mem::replace(
                    &mut self.items[i.index as usize],
                    Entry::Free {
                        next_free: self.free_list_head,
                    },
                );
                self.generation += 1;
                self.free_list_head = Some(i.index);
                self.len -= 1;
                match entry {
                    Entry::Occupied {
                        generation: _,
                        value,
                    } => Some(value),
                    _ => unreachable!(),
                }
            }
            _ => None,
        }
    }
pub fn remove ( & mut self , i : Index ) -> Option < T > { if i . index >= self . items . len ( ) as u32 { return None ; } match self . items [ i . index as usize ] { Entry :: Occupied { generation , .. } if i . generation == generation => { let entry = mem :: replace ( & mut self . items [ i . index as usize ] , Entry :: Free { next_free : self . free_list_head , } , ) ; self . generation += 1 ; self . free_list_head = Some ( i . index ) ; self . len -= 1 ; match entry { Entry :: Occupied { generation : _ , value , } => Some ( value ) , _ => unreachable ! ( ) , } } _ => None , } }
Remove the element at index `i` from the arena.
Remove the element at index ` i ` from the arena .
&mut self
i
Index
examples
```ignore
use rapier::data::arena::Arena.

let mut arena = Arena::new();
let idx = arena.insert(42).

assert_eq!(arena.remove(idx), Some(42));
assert_eq!(arena.remove(idx), None);
```
` ` ` ignore use rapier :: data :: arena :: Arena . let mut arena = Arena :: new () ; let idx = arena . insert ( 42 ) . assert_eq! ( arena . remove ( idx ) Some ( 42 )) ; assert_eq! ( arena . remove ( idx ) None ) ; ` ` `