From c55787d00905dced9dd5fd9c5b8c92928a8c2eaa Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 7 Jan 2013 08:46:24 -0800 Subject: [PATCH] core: add a vec.consume method --- src/libcore/vec.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index bf3fd8166c2..e84ec40f7a9 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1756,6 +1756,7 @@ pub trait OwnedVector { fn swap_remove(&mut self, index: uint) -> T; fn truncate(&mut self, newlen: uint); fn retain(&mut self, f: pure fn(t: &T) -> bool); + fn consume(self, f: fn(uint, v: T)); } impl ~[T]: OwnedVector { @@ -1809,6 +1810,10 @@ fn retain(&mut self, f: pure fn(t: &T) -> bool) { retain(self, f); } + #[inline] + fn consume(self, f: fn(uint, v: T)) { + consume(self, f) + } } pub trait OwnedCopyableVector {