pub enum GameTree {
GoGame(SgfNode<Prop>),
Unknown(SgfNode<Prop>),
}Expand description
An SGF GameTree value.
This type allows creating a collection of SgfNode values for different games. This is
used in the return type of the parse function. Users of the
serialize function will need to build these.
For now, all non-Go games will parse as GameTree::Unknown which should also be used for any
serialization of non-Go games.
Variants§
Implementations§
source§impl GameTree
impl GameTree
sourcepub fn into_go_node(self) -> Result<SgfNode<Prop>, SgfParseError>
pub fn into_go_node(self) -> Result<SgfNode<Prop>, SgfParseError>
Consumes a Go game GameTree and returns the contained SgfNode.
This is a convenience method for go games.
Errors
Returns an error if the variant isn’t a GameTree::GoGame.
Examples
use sgf_parse::parse;
let gametree = parse("(;B[de]C[A comment])").unwrap().into_iter().next().unwrap();
let sgf_node = gametree.into_go_node().unwrap();Trait Implementations§
source§impl PartialEq<GameTree> for GameTree
impl PartialEq<GameTree> for GameTree
impl StructuralPartialEq for GameTree
Auto Trait Implementations§
impl RefUnwindSafe for GameTree
impl Send for GameTree
impl Sync for GameTree
impl Unpin for GameTree
impl UnwindSafe for GameTree
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more