Last active
August 29, 2015 14:23
-
-
Save cedelmaier/9e77a24e6e95cfaee597 to your computer and use it in GitHub Desktop.
Attempt at using oyashio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate oyashio; | |
use oyashio::{Stream}; | |
use std::thread; | |
fn main() { | |
let (mut st, mut sr) = Stream::new(); | |
let input = vec!["The", | |
"quick", | |
"brown", | |
"fox", | |
"jumped", | |
"over", | |
"the", | |
"lazy", | |
"dog."]; | |
// Send the lines | |
for line in input { | |
st.send(line); | |
} | |
for i in 0..3 { | |
let src = sr.clone(); | |
thread::spawn(move || { | |
for n in src.poll() { | |
println!("Thread: {}, \n\t{}", i, n); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment