diff --git a/src/lib.rs b/src/lib.rs index 6c86f72..2599d5d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,6 +107,10 @@ impl ArrayVec { #[inline] pub fn capacity(&self) -> usize { A::capacity() } + /// Remove all elements in the vector. + pub fn clear(&mut self) { + while let Some(_) = self.pop() { } + } /// Push **element** to the end of the vector. ///