MCPcopy Create free account
hub / github.com/Lokathor/tinyvec / swap_remove

Method swap_remove

src/arrayvec.rs:1077–1090  ·  view source on GitHub ↗
(&mut self, index: usize)

Source from the content-addressed store, hash-verified

1075 /// ```
1076 #[inline]
1077 pub fn swap_remove(&mut self, index: usize) -> A::Item {
1078 assert!(
1079 index < self.len(),
1080 "ArrayVec::swap_remove> index {} is out of bounds {}",
1081 index,
1082 self.len
1083 );
1084 if index == self.len() - 1 {
1085 self.pop().unwrap()
1086 } else {
1087 let i = self.pop().unwrap();
1088 replace(&mut self[index], i)
1089 }
1090 }
1091
1092 /// Reduces the vec's length to the given value.
1093 ///

Callers

nothing calls this directly

Calls 2

lenMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected