2016-04-26 12:51:14 -05:00
|
|
|
use std::thread;
|
|
|
|
use std::sync::mpsc::{Receiver, channel};
|
|
|
|
|
|
|
|
pub fn foo<T:'static + Send + Clone>(x: T) -> Receiver<T> {
|
|
|
|
let (tx, rx) = channel();
|
|
|
|
thread::spawn(move|| {
|
|
|
|
tx.send(x.clone());
|
|
|
|
});
|
|
|
|
rx
|
2015-03-18 16:05:24 -05:00
|
|
|
}
|