Practice It: Rust File Manipulation
1h 31mIntermediate2022-12-06
Authors

Marcus Willock
Senior Software Engineer and Content Creator
Course details
In this course, learn coding best practices and gain greater proficiency in Rust by completing common programming tasks. These tasks include file manipulation, construction of functions, and the usage of collections such as Vec and Hashmaps. In the end, instructor Marcus Willock brings this list of tasks together to complete your final exam: read a file, change the targeted words of that file at will, and then create a new file with your changes. In more explicit terms, take the first chapter of Alice in Wonderland and remove Alice from the story and replace her with yourself.
Skills covered
RustProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Practice Rust file manipulation
- 02 - Using GitHub Codespaces with this course
- 03 - Preassessment
1. Files
- 04 - Overview of interacting with files
- 05 - Try it - Open a file in the same directory
- 06 - Check it - Open a file in the same directory
- 07 - Try it - Print each line of file on a new line
- 08 - Check it - Print each line of file on a new line
- 09 - Try it - Only print a line if it contains the wanted string
- 10 - Check it - Only print a line if it contains the wanted string
- 11 - Try it - Write to file
- 12 - Check it - Write to file
2. Functions
- 13 - Overview of functions
- 14 - Try it - Function that prints wanted lines from a file
- 15 - Check it - Function that prints wanted lines from a file
- 16 - Try it - Function with a param and return value
- 17 - Check it - Function with a param and return value
- 18 - Try it - Function that returns a result
- 19 - Check it - Function that returns a result
3. Vec
- 20 - Overview of Vec
- 21 - Try it - Vec of file lines
- 22 - Check it - Vec of file lines
- 23 - Check it - (functional programming style) Vec of file lines
- 24 - Try it - Vec of words from string
- 25 - Check it - Vec of words from string
- 26 - Check it - Vec of words from string (functional programming style)
- 27 - Try it - Vec of words to file
- 28 - Check it - Vec of words to file
- 29 - Try it - Nested Vec of lines and words
- 30 - Check it - Nested Vec of lines and words
- 31 - Check it - Nested Vec of lines and words (functional programming style)
4. HashMap
- 32 - Overview of HashMap
- 33 - Try it - Word count
- 34 - Check it - Word count
- 35 - Try it - Replace x with y (in place)
- 36 - Check it - Replace x with y (in place)
5. Finale
- 37 - Try it - Insert yourself into the story
- 38 - Check it - Insert yourself into the story
Conclusion
- 39 - Next steps