Chapter 03¶
&self¶
The &self is actually short for 'self: &Self'
Shadowing¶
-
Shadowing is different from marking a variable as
mutbecause we’ll get a compile-time error if we accidentally try to reassign to this variable without using theletkeyword. -
The other difference between
mutand shadowing is that because we’re effectively creating a new variable when we use theletkeyword again, "we can change the type of the value but reuse the same name"
Array¶
Auto fill array
Iterators: iterators produce a series of values, and we can call the collect method on an iterator to turn it into a collection.