Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (24 sloc) 752 Bytes
// build-pass (FIXME(62277): could be check-pass?)
use std::thread;
use std::sync::mpsc::Sender;
type RingBuffer = Vec<f64> ;
type SamplesFn = Box<dyn FnMut(&RingBuffer) + Send>;
enum Msg
GetSamples(String, SamplesFn), // sample set name, callback which receives samples
fn foo(name: String, samples_chan: Sender<Msg>) {
thread::spawn(move|| {
let mut samples_chan = samples_chan;
let callback: SamplesFn = Box::new(move |buffer| {
for i in 0..buffer.len() {
println!("{}: {}", i, buffer[i])
samples_chan.send(Msg::GetSamples(name.clone(), callback));
pub fn main() {}
You can’t perform that action at this time.