core: Add &self to core::iter methods
This commit is contained in:
@@ -20,46 +20,53 @@ use cmp::{Eq, Ord};
|
||||
use self::inst::{IMPL_T, EACH, SIZE_HINT};
|
||||
|
||||
impl<A> IMPL_T<A>: iter::BaseIter<A> {
|
||||
pure fn each(blk: fn(v: &A) -> bool) { EACH(&self, blk) }
|
||||
pure fn size_hint() -> Option<uint> { SIZE_HINT(&self) }
|
||||
pure fn each(&self, blk: fn(v: &A) -> bool) { EACH(self, blk) }
|
||||
pure fn size_hint(&self) -> Option<uint> { SIZE_HINT(self) }
|
||||
}
|
||||
|
||||
impl<A> IMPL_T<A>: iter::ExtendedIter<A> {
|
||||
pure fn eachi(blk: fn(uint, v: &A) -> bool) { iter::eachi(&self, blk) }
|
||||
pure fn all(blk: fn(&A) -> bool) -> bool { iter::all(&self, blk) }
|
||||
pure fn any(blk: fn(&A) -> bool) -> bool { iter::any(&self, blk) }
|
||||
pure fn foldl<B>(b0: B, blk: fn(&B, &A) -> B) -> B {
|
||||
iter::foldl(&self, move b0, blk)
|
||||
pure fn eachi(&self, blk: fn(uint, v: &A) -> bool) {
|
||||
iter::eachi(self, blk)
|
||||
}
|
||||
pure fn position(f: fn(&A) -> bool) -> Option<uint> {
|
||||
iter::position(&self, f)
|
||||
pure fn all(&self, blk: fn(&A) -> bool) -> bool {
|
||||
iter::all(self, blk)
|
||||
}
|
||||
pure fn any(&self, blk: fn(&A) -> bool) -> bool {
|
||||
iter::any(self, blk)
|
||||
}
|
||||
pure fn foldl<B>(&self, b0: B, blk: fn(&B, &A) -> B) -> B {
|
||||
iter::foldl(self, move b0, blk)
|
||||
}
|
||||
pure fn position(&self, f: fn(&A) -> bool) -> Option<uint> {
|
||||
iter::position(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Eq> IMPL_T<A>: iter::EqIter<A> {
|
||||
pure fn contains(x: &A) -> bool { iter::contains(&self, x) }
|
||||
pure fn count(x: &A) -> uint { iter::count(&self, x) }
|
||||
pure fn contains(&self, x: &A) -> bool { iter::contains(self, x) }
|
||||
pure fn count(&self, x: &A) -> uint { iter::count(self, x) }
|
||||
}
|
||||
|
||||
impl<A: Copy> IMPL_T<A>: iter::CopyableIter<A> {
|
||||
pure fn filter_to_vec(pred: fn(a: A) -> bool) -> ~[A] {
|
||||
iter::filter_to_vec(&self, pred)
|
||||
pure fn filter_to_vec(&self, pred: fn(a: A) -> bool) -> ~[A] {
|
||||
iter::filter_to_vec(self, pred)
|
||||
}
|
||||
pure fn map_to_vec<B>(op: fn(v: A) -> B) -> ~[B] {
|
||||
iter::map_to_vec(&self, op)
|
||||
pure fn map_to_vec<B>(&self, op: fn(v: A) -> B) -> ~[B] {
|
||||
iter::map_to_vec(self, op)
|
||||
}
|
||||
pure fn to_vec() -> ~[A] { iter::to_vec(&self) }
|
||||
pure fn to_vec(&self) -> ~[A] { iter::to_vec(self) }
|
||||
|
||||
pure fn flat_map_to_vec<B:Copy,IB:BaseIter<B>>(op: fn(a: A) -> IB)
|
||||
pure fn flat_map_to_vec<B:Copy,IB:BaseIter<B>>(&self, op: fn(a: A) -> IB)
|
||||
-> ~[B] {
|
||||
iter::flat_map_to_vec(&self, op)
|
||||
iter::flat_map_to_vec(self, op)
|
||||
}
|
||||
pure fn find(&self, f: fn(A) -> bool) -> Option<A> {
|
||||
iter::find(self, f)
|
||||
}
|
||||
|
||||
pure fn find(p: fn(a: A) -> bool) -> Option<A> { iter::find(&self, p) }
|
||||
}
|
||||
|
||||
impl<A: Copy Ord> IMPL_T<A>: iter::CopyableOrderedIter<A> {
|
||||
pure fn min() -> A { iter::min(&self) }
|
||||
pure fn max() -> A { iter::max(&self) }
|
||||
pure fn min(&self) -> A { iter::min(self) }
|
||||
pure fn max(&self) -> A { iter::max(self) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user