[OPTIONS] FLAGS: -c, –count Show the count of posts -h, –help Prints help information -V, –version Prints version information OPTIONS: -n, –number <NUMBER> Only print the NUMBE
= App::new("readrust") .version("0.1") .author("Florian G. <[email protected]>") .about("Reads readrust.net") .args_from_usage("-n, –number=[NUMBER] ’Only print the NUMBER most recent posts’ -c, –count ’Show the count of posts’"); let matches = app.get_matches(); }
Reads readrust.net USAGE: readrust [FLAGS] [OPTIONS] FLAGS: -c, –count Show the count of posts -h, –help Prints help information -V, –version Prints version information OPTIONS: -n, –number <NUMBER> Only print the NUMBER most recent posts
iter = feed.items.into_iter(); if let Some(string) = matches.value_of("number") { let number = string.parse().unwrap(); print_feed_table(iter.take(number)) } else { print_feed_table(iter) } }
to learn something new • You want that extra bit of perfor- mance • You want the control of C, but the safety of Python • You want to parallelise things
for _ in 1..3 { let handle = rc.clone(); std::thread::spawn(move || { // `std::rc::Rc<Counter>` cannot be sent between threads safely increment(&mut handle); }); }