mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
11 lines
222 B
Rust
11 lines
222 B
Rust
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
|
|
}
|