Menu
  • HOME
  • TAGS

Printing a tree — attempted access of field, but no field with that name was found

rust,imperative-programming,imperative-languages

Just because both variants of Node have a value field, doesn't mean you can access it directly. You can get it by matching on the value (these are equivalent): let value = match leaf { Node::Branch { value, .. } => value, Node::Leaf { value } => value, }; let...