Ref keyword versus &

In patterns, & destructures a borrow, ref binds to a location by-reference rather than by-value. In other words, & lets you reach through a borrow, and ref says "take a borrow to this place within the thing I'm matching".

6 Likes