summary refs log tree commit diff
path: root/src/libcore/iter-trait/option.rs
blob: 530de27c614c62cf0301466a7479d68b670848aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
type IMPL_T<A> = option<A>;

fn EACH<A>(self: IMPL_T<A>, f: fn(A) -> bool) {
    alt self {
      none { }
      some(a) { f(a); }
    }
}

fn SIZE_HINT<A>(self: IMPL_T<A>) -> option<uint> {
    alt self {
      none { some(0u) }
      some(_) { some(1u) }
    }
}