From 3175d97f80f046a4a4366b90fee15aeb7c5f4a68 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 23 May 2015 03:12:27 +0200 Subject: [PATCH] Implement ArrayVec::clear --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) 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. ///