From ed7c9c4e2a248c33f12c4a14d23dfe1b347a6310 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 16 Feb 2013 18:55:25 -0500 Subject: [PATCH] add a Mutable implementation (clear) to std::deque --- src/libstd/deque.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 86b904be3cb..d8fca5c8532 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -28,6 +28,15 @@ impl Container for Deque { pure fn is_empty(&self) -> bool { self.len() == 0 } } +impl Mutable for Deque { + fn clear(&mut self) { + for vec::each_mut(self.elts) |x| { *x = None } + self.nelts = 0; + self.lo = 0; + self.hi = 0; + } +} + impl Deque { static pure fn new() -> Deque { Deque{nelts: 0, lo: 0, hi: 0,