This repository is part of the Rust Fundamentals Coursera course and Systems Engineering specialization by Duke University
Rust Bootcamp week 3: Structs, Types, and Enums
This week, you will learn how to create structs, types, and enums as well defining new types and extending them. You will use types like String
and manipulate other data structures like vectors and hash maps. Enum
s in Rust are similar to enum
s in other languages, but they have some interesting features that make them more powerful like the Option
and Result
types that can be used to handle errors with match
expressions.
This is week 3 of the Rust Bootcamp. There are 4 weeks in total:
π‘ Are you just looking for a π Rust template to get started easily with a project? The template has everything you need!
π Watch the Video course
This week has several examples located in the ./examples directory. Make sure you have Rust installed and you are using Visual Studio Code.
This repository is Codespaces ready, and it is set as a template repository. You can create a new repository from this template and start working on your own with Codespaces. This means that Rust, Copilot, and all the extensions are already installed and configured for you.
- Defining structs
- Creating struct instances
- Associated functions and constructors
- Extending with methods
- Using the debug attribute
- Understanding String and str
- Getting started with Rust string manipulation
- Basics of Vectors
- Retrieving values from Vectors
- Adding elements to Vectors
- Defining an Enum
- Using Enum as a Type
- The Option Enum
- Match and Enums
- Using Vectors with Enums
- Exhaustive matches
Use the included practice lab to apply the content you've learned in this week. Follow the steps to create your own repository and apply the requirements to complete the lab.
Coursera Courses