2012-08-20 20:47:16 -05:00
|
|
|
|
|
|
|
trait thing<A> {
|
2012-08-20 14:23:37 -05:00
|
|
|
fn foo() -> Option<A>;
|
2012-08-20 20:47:16 -05:00
|
|
|
}
|
|
|
|
impl<A> int: thing<A> {
|
2012-08-20 14:23:37 -05:00
|
|
|
fn foo() -> Option<A> { None }
|
2012-08-20 20:47:16 -05:00
|
|
|
}
|
2012-08-20 14:23:37 -05:00
|
|
|
fn foo_func<A, B: thing<A>>(x: B) -> Option<A> { x.foo() }
|
2012-08-20 20:47:16 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
2012-09-25 19:39:22 -05:00
|
|
|
for iter::eachi(&(Some({a: 0}))) |i, a| {
|
2012-10-12 14:32:36 -05:00
|
|
|
debug!("%u %d", i, a.a);
|
2012-08-20 20:47:16 -05:00
|
|
|
}
|
|
|
|
|
2012-08-20 14:23:37 -05:00
|
|
|
let _x: Option<float> = foo_func(0);
|
2012-08-20 20:47:16 -05:00
|
|
|
}
|