Trait pgn_reader::Visitor
[−]
[src]
pub trait Visitor<'pgn> { type Result; fn end_game(&mut self, game: &'pgn [u8]) -> Self::Result; fn begin_game(&mut self) { ... } fn begin_headers(&mut self) { ... } fn header(&mut self, _key: &'pgn [u8], _value: &'pgn [u8]) { ... } fn end_headers(&mut self) -> Skip { ... } fn san(&mut self, _san: San) { ... } fn nag(&mut self, _nag: Nag) { ... } fn comment(&mut self, _comment: &'pgn [u8]) { ... } fn begin_variation(&mut self) -> Skip { ... } fn end_variation(&mut self) { ... } fn outcome(&mut self, _outcome: Outcome) { ... } }
Consumes games from a reader.
Associated Types
type Result
Required Methods
fn end_game(&mut self, game: &'pgn [u8]) -> Self::Result
Called after parsing a game. Can return a custom result.
Provided Methods
fn begin_game(&mut self)
Called at the start of a game.
fn begin_headers(&mut self)
Called directly before reading game headers.
fn header(&mut self, _key: &'pgn [u8], _value: &'pgn [u8])
Called when parsing a game header like [White "Deep Blue"]
.
fn end_headers(&mut self) -> Skip
Called after reading the headers of a game. May skip quickly over the
following move text directly to end_game
.
fn san(&mut self, _san: San)
Called for each move, like Nf3
.
fn nag(&mut self, _nag: Nag)
Called for each numeric annotation glyph, like !?
or $7
.
fn comment(&mut self, _comment: &'pgn [u8])
Called for each { comment }
with the whole comment as a byte slice,
excluding the braces.
fn begin_variation(&mut self) -> Skip
Called for each (
. May skip over the following variation directly
to end_variation
(or to end_game
if no )
follows before the end of
the game).
fn end_variation(&mut self)
Called for each )
. It is not guaranteed that there was a
matching (
.
fn outcome(&mut self, _outcome: Outcome)
Called for each game termination, like 1-0
.