aboutsummaryrefslogtreecommitdiff
path: root/vendor/flume/examples/simple.rs
blob: 39cb1bda5b55642aab80af3f7245bfbfd3f0ee4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::thread;

fn main() {
    let (tx, rx) = flume::unbounded();

    let t = thread::spawn(move || {
        for msg in rx.iter() {
            println!("Received: {}", msg);
        }
    });

    tx.send("Hello, world!").unwrap();
    tx.send("How are you today?").unwrap();

    drop(tx);

    t.join().unwrap();
}