Enum sgf_parse::GameTree[][src]

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

GoGame(SgfNode<Prop>)
Unknown(SgfNode<Prop>)

Implementations

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();

Returns the GameType for this GameTree.

Examples

use sgf_parse::{parse, GameType};

let gametree = parse("(;GM[1]B[de]C[A comment])").unwrap().into_iter().next().unwrap();
assert_eq!(gametree.gametype(), GameType::Go);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.