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

27 lines
564 B
Rust
Raw Normal View History

extern mod extra;
use std::comm::Chan;
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 uint::range(0, buffer.len())
|i| {error!("%?: %f", i, buffer[i])}
};
2013-03-15 17:27:15 -05:00
samples_chan.send(GetSamples(name.clone(), callback));
};
}
pub fn main() {}