4 ms·
I don't think that is true. Testing with rust 1.92 enum Tree<T> { Lead(T), Branch(Vec<Tree<T>>), } works just fine, no superfluous Box needed.
by YmiYugy 9mo ago
I don't think that is true.
Testing with rust 1.92
enum Tree<T> {
Lead(T),
Branch(Vec<Tree<T>>),
}
works just fine, no superfluous Box needed.
- slavapestov 9mo agoSimilarly, the ‘indirect’ keyword can be omitted from Swift example in the blog post, for the same reason. A Swift Array stores its elements out of line, so an enum case payload can be an array type whose element contains the same enum, without any additional indirection.