From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development

Unlock this course with a free trial

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

Introduction to structured data

Introduction to structured data

- Rust has this way of organizing similar data in a structure. And the key word there for Rust is the struct. And a struct is kind of like, think about organizing or categorizing data that is similar, right? If you're coming from JavaScript, you might think you could do something similar with an object in JavaScript or a Python dictionary, for example, or a hashmap. Those are similar. I mean, it's not quite the same, but you're organizing data in a structured way. That's where struct comes from. And we'll see not only how to define it, but also a little bit of how to work with it. And we'll take a look at a special implementation of structs that allow us to create a constructor, like an easy function related to the struct that allows us to call that function and produce a struct for us instead of like building it from scratch every single time. There's definitely many different ways to create a structure, define it and interact with it. And we'll try to cover many of the few that…

Contents