Function sgf_parse::parse[][src]

pub fn parse(text: &str) -> Result<Vec<GameTree>, SgfParseError>
Expand description

Returns the GameTree values parsed from the provided text.

Errors

If the text can’t be parsed as an SGF FF[4] collection, then an error is returned.

Examples

use sgf_parse::{parse, GameType};

let sgf = "(;SZ[9]C[Some comment];B[de];W[fe])(;B[de];W[ff])";
let gametrees = parse(sgf).unwrap();
assert!(gametrees.len() == 2);
assert!(gametrees.iter().all(|gametree| gametree.gametype() == GameType::Go));