From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/flume/examples/simple.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vendor/flume/examples/simple.rs (limited to 'vendor/flume/examples/simple.rs') diff --git a/vendor/flume/examples/simple.rs b/vendor/flume/examples/simple.rs new file mode 100644 index 0000000..39cb1bd --- /dev/null +++ b/vendor/flume/examples/simple.rs @@ -0,0 +1,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(); +} -- cgit v1.2.3