Demode iter-trait

This commit is contained in:
Tim Chevalier
2012-09-25 17:39:22 -07:00
parent 473a866733
commit e19e628b19
21 changed files with 70 additions and 68 deletions

View File

@@ -2,17 +2,19 @@
// workaround our lack of traits and lack of macros. See core.{rc,rs} for
// how this file is used.
#[warn(deprecated_mode)];
use cmp::{Eq, Ord};
use inst::{IMPL_T, EACH, SIZE_HINT};
export extensions;
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(blk: fn(v: &A) -> bool) { EACH(&self, blk) }
pure fn size_hint() -> 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 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 {
@@ -24,8 +26,8 @@ impl<A> IMPL_T<A>: iter::ExtendedIter<A> {
}
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(x: &A) -> bool { iter::contains(self, x) }
pure fn count(x: &A) -> uint { iter::count(self, x) }
}
impl<A: Copy> IMPL_T<A>: iter::CopyableIter<A> {