Answer by NonlinearFruit for Join and map command line arguments in Rust
Here are some improvements:If you don't want the first arg, skip itenv::args().skip(1).collect()Get the reference (last arg) with popGet the book (remaining args) with joinargs.join("")Use &str...
View ArticleAnswer by JayDepp for Join and map command line arguments in Rust
Rather than using a hashmap to lookup the books, we can use a match block. (This is assuming that your books are known at compile time.) Also, we can return an Option<&'static str>. The...
View ArticleAnswer by Aurora0001 for Join and map command line arguments in Rust
I've collected a few thoughts about possible refactors you could consider below.Your if chain isn't the most efficient wayAs you've written it, your code will only work for titles between one and four...
View ArticleJoin and map command line arguments in Rust
Is there a more natural way to do this in rust? I'm having a lot of difficulty trying to make this look clean. Type mismatches and borrowing have me stumped. What are some refactors that I could...
View Article
More Pages to Explore .....