1extern crate streams_rs;
2
3use streams_rs::fn_stream::FnStream;
4use streams_rs::*;
5fn main() {
6 let mut count = 0;
7 let get = || {
8 count += 1;
9 StreamResult::Ok(count - 1)
10 };
11 let mut stream = FnStream::new(get);
12
13 let _ = smatch!(match (stream) {
14 [0=>] => { println!("Zero!");
16 }
17 });
18 let _ = smatch!(match (stream) {
19 [1=>] => { println!("One!");
21 }
22 });
23 for _ in 0..10 {
24 let _ = smatch!(match (stream) {
25 [a=>b=>] => { println!("a: {} b: {}",a,b);
27 }
28 });
29 }
30}