| 1 | use std::thread; |
| 2 | |
| 3 | fn main() { |
| 4 | let (tx, rx) = flume::unbounded(); |
| 5 | |
| 6 | let t = thread::spawn(move || { |
| 7 | for msg in rx.iter() { |
| 8 | println!("Received: {}", msg); |
| 9 | } |
| 10 | }); |
| 11 | |
| 12 | tx.send("Hello, world!").unwrap(); |
| 13 | tx.send("How are you today?").unwrap(); |
| 14 | |
| 15 | drop(tx); |
| 16 | |
| 17 | t.join().unwrap(); |
| 18 | } |