MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / swap_remove

Method swap_remove

src/entity/compact_list.rs:100–104  ·  view source on GitHub ↗

Removes an element from the list at the given index. The removed element is replaced with the last element of the list and the list is shrunk by one element.

(&mut self, index: usize, pool: &mut CompactListPool<T>)

Source from the content-addressed store, hash-verified

98 /// The removed element is replaced with the last element of the list and
99 /// the list is shrunk by one element.
100 pub fn swap_remove(&mut self, index: usize, pool: &mut CompactListPool<T>) {
101 let slice = self.as_mut_slice(pool);
102 slice.swap(index, slice.len() - 1);
103 self.end -= 1;
104 }
105}
106
107impl<T> Default for CompactList<T> {

Callers 5

gen_subclassMethod · 0.80
gen_groupsMethod · 0.80
gen_regMethod · 0.80
gen_instMethod · 0.80
arbitraryMethod · 0.80

Calls 2

as_mut_sliceMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected