Command line tools: Implementing wc in Rust

wc

Plan for improvements in the next session

  • Instead of text.split('\n').collect::<Vec<_>>().len(); write text.split('\n').count();
  • Instead of for filename in args[1..].iter() { write for filename in std::env::args().skip(1)
  • Setup CI
  • Test running the command line
  • return struct instead tuple of 3 usize values
  • Command line flags

Related Pages

Rust Maven Live presentations
Counting iterations - count() vs collect().len()

Author

Gabor Szabo (szabgab)

Gabor Szabo, the author of the Rust Maven web site maintains several Open source projects in Rust and while he still feels he has tons of new things to learn about Rust he already offers training courses in Rust and still teaches Python, Perl, git, GitHub, GitLab, CI, and testing.

Gabor Szabo