2011-04-13 15:21:06 -05:00
|
|
|
|
|
|
|
|
2012-08-01 19:30:05 -05:00
|
|
|
fn mk() -> int { return 1; }
|
2011-04-13 15:21:06 -05:00
|
|
|
|
2011-12-22 19:53:53 -06:00
|
|
|
fn chk(&&a: int) { log(debug, a); assert (a == 1); }
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2012-07-03 18:11:00 -05:00
|
|
|
fn apply<T>(produce: extern fn() -> T,
|
|
|
|
consume: extern fn(T)) {
|
2012-01-11 11:58:05 -06:00
|
|
|
consume(produce());
|
|
|
|
}
|
2011-04-13 15:21:06 -05:00
|
|
|
|
|
|
|
fn main() {
|
2012-07-03 18:11:00 -05:00
|
|
|
let produce: extern fn() -> int = mk;
|
|
|
|
let consume: extern fn(&&int) = chk;
|
2011-08-13 02:10:18 -05:00
|
|
|
apply::<int>(produce, consume);
|
2011-08-12 08:37:25 -05:00
|
|
|
}
|