1 2 3 4 5 6 7 8 9 10
enum maybe<T> { just(T), nothing } impl methods<T:copy> for maybe<T> { fn ~[](idx: uint) -> T { match self { just(t) { t } nothing { fail; } } } }