News for hackers. Stuff that matters.
Re:Rust for JavaScript Developers – Pattern Matching and Enums by steveklabnik on Sunday July 12, 2020 @12:49PM (#23812690)
Not the author, but yes, this is because the thing between "let" and "=" is a pattern, the exact same thing used in match, and in other places. For example, function arguments!

  fn takes_person(p: Person) {

  fn takes_person(Person {name, city}: Person) {
But I wouldn't inherently say that's the reason, it's also because structs are nominally rather than structurally typed.

There are no comments on this comment yet.