book icon indicating copy to clipboard operation
book copied to clipboard

Clarifying @ bindings (suggestion rather than bug)

Open kubycsolutions opened this issue 3 years ago • 0 comments

In ch18-03-pattern-syntax, discussion of listing 18-29 (@ Bindings), It might be useful to say whether the structure shorthand Message::Hello { id } => {} is in fact equivalent to Message::Hello { id: id @}

I'm not sure if the latter syntax (explicit binding without specifying value/range) is accepted, but conceptually I think that's what the shorthand maps to ... and pointing that similarity to something already seen might help nail down the reader's understanding of @ binding semantics.

kubycsolutions avatar Nov 01 '22 15:11 kubycsolutions