O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise - fix the word counter

Here's a program that counts instances of words in a text file, given to it as its first parameter. It is almost complete but has a few bugs that the compiler catches, and a couple of subtle ones. Go ahead and type the program text into a file, try to compile it, and try to fix all the bugs with the help of the compiler. The point of this exercise, in addition to covering the topics of this chapter, is to make you more comfortable with the error messages of the Rust compiler, which is an important skill for an aspiring Rust developer.

Try to make an effort even when things seem hopeless; every drop of tear and sweat brings you a step closer to being a master. Detailed answers to the task can be found in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required