2012-05-14 00:12:58 -05:00
|
|
|
enum maybe<T> { just(T), nothing }
|
|
|
|
|
|
|
|
impl methods<T:copy> for maybe<T> {
|
2012-06-29 18:26:56 -05:00
|
|
|
fn ~[](idx: uint) -> T {
|
2012-08-06 14:34:08 -05:00
|
|
|
match self {
|
2012-05-14 00:12:58 -05:00
|
|
|
just(t) { t }
|
|
|
|
nothing { fail; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|