rust/src/test/run-pass/issue-3609.rs

27 lines
602 B
Rust
Raw Normal View History

extern mod extra;
use std::comm::Chan;
use std::task;
type RingBuffer = ~[f64];
type SamplesFn = proc(samples: &RingBuffer);
enum Msg
{
GetSamples(~str, SamplesFn), // sample set name, callback which receives samples
}
fn foo(name: ~str, samples_chan: Chan<Msg>) {
2014-01-27 17:29:50 -06:00
task::spawn(proc() {
2013-12-05 20:19:06 -06:00
let mut samples_chan = samples_chan;
let callback: SamplesFn = proc(buffer) {
for i in range(0u, buffer.len()) {
error!("{}: {}", i, buffer[i])
}
};
2013-03-15 17:27:15 -05:00
samples_chan.send(GetSamples(name.clone(), callback));
2014-01-27 17:29:50 -06:00
});
}
pub fn main() {}