[−][src]Enum shakmaty::uci::Uci
A move as represented in the UCI protocol.
Variants
A normal move, e.g. e2e4
or h2h1q
.
A piece drop, e.g. Q@f7
.
A null move (0000
).
Methods
impl Uci
[src]
pub fn from_ascii(uci: &[u8]) -> Result<Uci, ParseUciError>
[src]
Parses a move in UCI notation.
Errors
Returns ParseUciError
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, });
pub fn from_move<P: Position>(pos: &P, m: &Move) -> Uci
[src]
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()
.
pub fn from_chess960(m: &Move) -> Uci
[src]
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.
pub fn to_move<P: Position>(&self, pos: &P) -> Result<Move, IllegalMoveError>
[src]
Tries to convert the Uci
to a legal Move
in the context of a
position.
Errors
Returns IllegalMoveError
if the move is not legal.
Trait Implementations
impl Clone for Uci
[src]
impl Debug for Uci
[src]
impl Display for Uci
[src]
impl Eq for Uci
[src]
impl FromStr for Uci
[src]
type Err = ParseUciError
The associated error which can be returned from parsing.
fn from_str(uci: &str) -> Result<Uci, ParseUciError>
[src]
impl Hash for Uci
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Uci> for Uci
[src]
impl StructuralEq for Uci
[src]
impl StructuralPartialEq for Uci
[src]
Auto Trait Implementations
impl RefUnwindSafe for Uci
impl Send for Uci
impl Sync for Uci
impl Unpin for Uci
impl UnwindSafe for Uci
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,