core: add a vec.consume method
This commit is contained in:
parent
8f9a507973
commit
c55787d009
@ -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> {
|
||||
|
Loading…
Reference in New Issue
Block a user