summary refs log tree commit diff
path: root/src/libcore/iter-trait/option.rs
blob: 44afe9f54f00c6eca225176f675ead7e268129b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[allow(non_camel_case_types)]
pub type IMPL_T<A> = Option<A>;

pub pure fn EACH<A>(self: &IMPL_T<A>, f: fn(v: &A) -> bool) {
    match *self {
      None => (),
      Some(ref a) => { f(a); }
    }
}

pub pure fn SIZE_HINT<A>(self: &IMPL_T<A>) -> Option<uint> {
    match *self {
      None => Some(0),
      Some(_) => Some(1)
    }
}