Mutability of data structures

We cannot use the mut keyword to make the contained values within a structure mutable, and leaving the keyword off does not make them immutable. Instead, the entire structure is mutable or immutable on a case-by-case basis. See the following, for example:

let change_no: Constrained;
let mut change_yes: Constrained;

The preceding code means that there are two variables, both with Constrained as their data type, but the value stored in change_no is immutable while the value stored in change_yes is mutable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.151.44