/word-counter

word counter implemented in rust

Primary LanguageRust

Introduction

Rust is something I've decided to learn now during the summer break before my third year of studying computer science. For me, the best way to learn a new language is by implementing something in said language. I will mainly be using the Rust book and "Rust By Example" to learn Rust but also go through the "tourofrust" site and streams by Jon Gjengset and Ryan Levick.

In one of our programming classes at uni, a small project we had to do in order to learn C was to create a word counter and the data structures used by that word counter from scratch. I felt that, that was a great way to learn C and thought of doing the same for Rust.

Word Counter

The idea is to create a program that goes through a text file and stores the occurrences and count of each word inside of a hash map. The user will have to provide the location of the text file when prompted to and then decide if the result should be stored inside of a text file or directly to the terminal.

What do I need to build?

  • Hash map
  • Some kind of tokenizer or string slicer

Hopefully this will make me learn all about generics, how String/str work in Rust, lifetimes/ownership, error handling and other fun stuff!