Skip to content

Commit c55787d

Browse files
committed
core: add a vec.consume method
1 parent 8f9a507 commit c55787d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libcore/vec.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,7 @@ pub trait OwnedVector<T> {
17561756
fn swap_remove(&mut self, index: uint) -> T;
17571757
fn truncate(&mut self, newlen: uint);
17581758
fn retain(&mut self, f: pure fn(t: &T) -> bool);
1759+
fn consume(self, f: fn(uint, v: T));
17591760
}
17601761

17611762
impl<T> ~[T]: OwnedVector<T> {
@@ -1809,6 +1810,10 @@ impl<T> ~[T]: OwnedVector<T> {
18091810
retain(self, f);
18101811
}
18111812

1813+
#[inline]
1814+
fn consume(self, f: fn(uint, v: T)) {
1815+
consume(self, f)
1816+
}
18121817
}
18131818

18141819
pub trait OwnedCopyableVector<T: Copy> {

0 commit comments

Comments
 (0)