pub unsafe fn swap_remove(&mut self, index: ArenaIndex) -> Option<*const u8> {
        assert!(*self.len > 0);
        let last_index = *self.len - 1;
        if last_index == index.0 {
            // if swapping last item
            self.pop_away();
            None
        } else {
            let last = self.at(ArenaIndex(*self.len - 1));
            let at_index = self.at_mut(index);
            ::std::ptr::copy_nonoverlapping(last, at_index, self.item_size);
            self.pop_away();
            Some(self.at(index))
        }
    }
/// Remove the item at index, by swapping it with the last item
/// and then popping, returning the swapped in item (unless empty).
///
/// This is a O(1) way of removing an item if the order of items doesn't matter.
Remove the item at index, by swapping it with the last item
and then popping, returning the swapped in item (unless empty).

This is a O(1) way of removing an item if the order of items doesn't matter.
Remove the item at index by swapping it with the last item and then popping returning the swapped in item ( unless empty ) . This is a O ( 1 ) way of removing an item if the order of items doesn ' t matter .
pub unsafe fn swap_remove(&mut self, index: ArenaIndex) -> Option<*const u8> {
        assert!(*self.len > 0);
        let last_index = *self.len - 1;
        if last_index == index.0 {
            // if swapping last item
            self.pop_away();
            None
        } else {
            let last = self.at(ArenaIndex(*self.len - 1));
            let at_index = self.at_mut(index);
            ::std::ptr::copy_nonoverlapping(last, at_index, self.item_size);
            self.pop_away();
            Some(self.at(index))
        }
    }
pub unsafe fn swap_remove ( & mut self , index : ArenaIndex ) -> Option < * const u8 > { assert ! ( self len 0 ) ; let last_index = * self . len - 1 ; if last_index == index . 0 { // if swapping last item self . pop_away ( ) ; None } else { let last = self . at ( ArenaIndex ( * self . len - 1 ) ) ; let at_index = self . at_mut ( index ) ; :: std :: ptr :: copy_nonoverlapping ( last , at_index , self . item_size ) ; self . pop_away ( ) ; Some ( self . at ( index ) ) } }
Remove the item at index, by swapping it with the last item
and then popping, returning the swapped in item (unless empty).
Remove the item at index by swapping it with the last item and then popping returning the swapped in item ( unless empty ) .
&mut self
index
ArenaIndex
&mut self
index
ArenaIndex