Enum shakmaty::uci::Uci[][src]

pub enum Uci {
    Normal {
        from: Square,
        to: Square,
        promotion: Option<Role>,
    },
    Put {
        role: Role,
        to: Square,
    },
    Null,
}

A move as represented in the UCI protocol.

Variants

A normal move, e.g. e2e4 or h2h1q.

Fields of Normal

A piece drop, e.g. Q@f7.

Fields of Put

A null move (0000).

Methods

impl Uci
[src]

Parses a move in UCI notation.

Errors

Returns InvalidUci if uci is not syntactically valid.

Examples

use shakmaty::uci::Uci;
use shakmaty::Square;

let uci = Uci::from_ascii(b"e4e5")?;

assert_eq!(uci, Uci::Normal {
    from: Square::E4,
    to: Square::E5,
    promotion: None,
});

Converts a move to UCI notation.

If pos does not and did not have castling rights that are only possible in Chess960, castling moves are represented as e1g1, e1c1, e8g8 and e8c8. Alternatively, see Uci::from_chess960().

Converts a move to UCI notation. Castling moves are represented as a move of the king to the corresponding rook square, independently of the position.

Tries to convert the Uci to a legal Move in the context of a position.

Errors

Returns IllegalMove if the move is not legal.

Trait Implementations

impl Clone for Uci
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for Uci
[src]

impl PartialEq for Uci
[src]

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

This method tests for !=.

impl Debug for Uci
[src]

Formats the value using the given formatter. Read more

impl FromStr for Uci
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl Display for Uci
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Uci

impl Sync for Uci