Sure, no spiral, but I still find the associativity of modifiers confusing. For example could you tell the difference between & mut &, & & mut and & mut &
mut right off the top of your head?
you should just see &mut and & as 2 separate modifier, maybe that'd help.
- & &mut doesn't make sense: and a variable of type & &mut can't mutate the underlying object, it's practically equivalent to a & &, even worse, since the inner is &mut, you can't have 2 & &mut that point to the same &mut (mut xor shared).
- &mut &: mutable reference that point to a shared reference, means you can change the outer to point to another shared reference, but you can't change content of the inner, for example:
let a: &str = "hello";
let b: &str = "world";
let mut c = &a;
let d = &mut c;
*d = &b;
// (*d).make_ascii_lowercase(); // not allowed
- &mut &mut: similar to the above, but you can also change the content of the inner.