PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/src/test/run-pass/generic-temporary.rs

http://github.com/jruderman/rust
Rust | 16 lines | 11 code | 5 blank | 0 comment | 1 complexity | 43611567bcfd8278ac374ab60345e58d MD5 | raw file
 1
 2
 3fn mk() -> int { return 1; }
 4
 5fn chk(&&a: int) { log(debug, a); assert (a == 1); }
 6
 7fn apply<T>(produce: extern fn() -> T,
 8            consume: extern fn(T)) {
 9    consume(produce());
10}
11
12fn main() {
13    let produce: extern fn() -> int = mk;
14    let consume: extern fn(&&int) = chk;
15    apply::<int>(produce, consume);
16}