Or am I missing something?
Or am I missing something?
Really, they are adding a new view, so perhaps this is like Haskell lenses, where you can make views with a different type that acts on underlying data
Let’s consider the case where T is u8. There are 256 inhabitants of the u8 type (0u8-255u8).
Now consider &u8. Each u8 referent is still some value between 0 and 255, but the number of references you could have is dependent on the pointer width of your target system — let’s say 64 bits. So that’s 2^8 possible u8 values times 2^64 possible references, or 2^72 inhabitants. Well, minus one to account for null, and I’m probably missing other details, but you get the idea.
So going from T to &T introduces structure in the same sense that going from T to (T, U) does; and going from &T to T destructures in the same sense that going from (T, U) to T does. That structure may not be directly observable (as in the case of a reference: you’d have to go out of your way to observe the underlying address), but conceptually the structure is there nonetheless.
Edit:
Another way to look at it is this:
Consider a Rust “newtype”, like struct Days(u8).
If you pattern match on that to obtain the inner u8, we call that destructuring. Destructuring is to reduce or break down the structure of a thing, so the opposite must be building up structure, or “restructuring”. Therefore going in the opposite direction — stuffing a u8 value in a Days - must be restructuring. In this case both types have the same number of inhabitants (256); regardless, one direction is destructuring and the other direction is restructuring.