core: add a vec.consume method

This commit is contained in:
Erick Tryzelaar 2013-01-07 08:46:24 -08:00
parent 8f9a507973
commit c55787d009

View File

@ -1756,6 +1756,7 @@ pub trait OwnedVector<T> {
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> ~[T]: OwnedVector<T> {
@ -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<T: Copy> {