Summary
-
You can create new types with a
struct
declaration -
struct
s allow you to combine multiple values into a larger value -
You can create a new value using a struct expression
-
You can access the fields of a struct using a field access expression
-
Every value in Rust has exactly one owner
-
You can move a value from one owner to another
-
The compiler will automatically make copies of some “copyable” types marked by the
Copy
trait -
You can move values out of a function in its return value
-
You can mutate fields in a
struct
as long as the variable holding thestruct
is markedmut
Get hands-on with 1400+ tech skills courses.