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.
Demo: Other struct uses - Rust Tutorial
From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development
Demo: Other struct uses
- [Instructor] There are other ways that we can define how we can instantiate. We can create a new instance of user, in this case. So before we've done something like, for example, user, and we've done something like this, where we're actually passing these fields, and those are fine. Well, this is actually incorrect. Email is john@example.com, and then that's fine, and we have that ability of creating that. So we, in this case, we're also need to do everything here. We can say, sure, that you are right, and active is true. Okay, perfect. So there we go. We have the ability of doing it that way, and that's definitely valid, but there's also a different way, and I'm going to actually show you how. So I'm going to make this go away. I'm going to do some surgery here. So we can actually start doing, defining these as variables. So if we say let username. So if these are named. Actually, let me go through all of these and then come back. All right, I redefined everything to be a variable…