From the course: Rust for Data Engineering

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

HashMap language comparison

HashMap language comparison - Rust Tutorial

From the course: Rust for Data Engineering

HashMap language comparison

- [Instructor] All right, so here we have a hash map example that is really fitting for, let's say, a data scientist or a data engineer, where a lot of times, you'll need to create your own custom metrics. Maybe those metrics will be fed into a dashboard or a database or something like that. In this case, I've gone through and used HashMap up here and created an a init_languages function. Inside of here, we see that I've created a mutable hash map. Inside this hash map, it's going to contain strings that are i32. We have JavaScript, HTML, Python, SQL, TypeScript, Bash/Shell, Java, C#, C++, C, et cetera, and what's really interesting is, once you start diving into the age of the languages here, it's a good thing to mix in with the popularity. So what I'm going to do is I'm going to make another function here called calculate_weights, and what this calculate weights accepts is the years active, and what it's going to do here,…

Contents