Rather than wrapping the Nodes in Boxes I tried try wrapping in an enum: enum Node {Chars(CharsNode), And(AndNode), Or(OrNode)... }
I've found I can get a reference to the contents which is in general good enough - the tree is immutable once it is built. During the build phase though there are a few times they may need to be mutable. Is there any way to get a mutable reference to a struct inside an enum? I've tried a bunch of different ways and have not stumbled across one that works.
If nothing else comes up I've implemented clone() on the Node structs so I can get a mutable copy and replace the original in the tree (the mut access only comes at one place, where the parent object is not yet wrapped in the enum). Still, it would be cleaner to modify in place, and I'd like to understand if this is possible.