Description
As a newbie, I made the mistake that can be witnessed with the field slice
in this question about other stuff.
The way this happened is that I vaguely remembered that you can't use mut
when specifying the fields of struct
and to make sure, I looked up the struct chapter in the book. Sure enough, it said "Mutability is a property of the binding, not of the structure itself."
Now, as a newbie, I thought this forbade mut
in field definitions altogether even though it only forbids mut
to the left of the colon and you can still have &mut
as the type to the right of the colon.
It would be nice if this was briefly clarified for the benefit of newbies looking stuff up piecemeal and not properly thinking about stuff in the context of what has previously been said in an earlier chapter.