rust/src/test/run-pass/issue-3609.rs
Daniel Micay 1008945528 remove obsolete foreach keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00

29 lines
593 B
Rust

extern mod extra;
use std::comm::Chan;
use std::task;
type RingBuffer = ~[float];
type SamplesFn = ~fn(samples: &RingBuffer);
enum Msg
{
GetSamples(~str, SamplesFn), // sample set name, callback which receives samples
}
fn foo(name: ~str, samples_chan: Chan<Msg>) {
do task::spawn
{
let callback: SamplesFn =
|buffer|
{
for i in range(0u, buffer.len()) {
error!("%?: %f", i, buffer[i])
}
};
samples_chan.send(GetSamples(name.clone(), callback));
};
}
pub fn main() {}