提交 c55787d0 编写于 作者: E Erick Tryzelaar

core: add a vec.consume method

上级 8f9a5079
......@@ -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> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册