[][src]Module shakmaty::san

Read and write Standard Algebraic Notation.

Examples

Parse and write SANs:

use shakmaty::{Chess, Position};
use shakmaty::san::San;

let san: San = "Nf3".parse()?;
assert_eq!(san.to_string(), "Nf3");

Converting to a move:

let pos = Chess::default();
let m = san.to_move(&pos)?;

assert_eq!(m, Move::Normal {
    role: Role::Knight,
    from: Square::G1,
    capture: None,
    to: Square::F3,
    promotion: None,
});

Back to a (possibly disambiguated) SAN:

assert_eq!(San::from_move(&pos, &m).to_string(), "Nf3");

Structs

ParseSanError

Error when parsing a syntactially invalid SAN.

SanPlus

A San and possible check and checkmate suffixes.

Enums

San

A move in Standard Algebraic Notation.

SanError

IllegalSan or AmbiguousSan.

Suffix

Check (+) or checkmate (#) suffix.