Closed julianandrews closed 3 years ago
Working on v3.0 I've decided to do away with the builder entirely.
Any constructible SgfNode
will be serializable, and there will be a validate
method which checks for validity. This way, users of the library can decide how they want to handle invalid (but still parseable/serializable) data.
Currently
SgfNode.into_builder
is a recursive function call (see #11), andSgfNodeBuilder.build
has a bunch ofRc
overhead and logic.In principle
SgfNode.into_builder
should be possible to with operation at all (with a little tweaking to ensure the memory layout is the same), and the other direction (SgfNodeBuilder.build
) could be zero-copy (though we'd still need to walk through and validate).If conversion between the two were costless, I could move the
SgfNode::new
logic intoSgfNodeBuilder.build
, and thenSgfNode::new
would just call that.