[−][src]Enum pgn_reader::San
A move in Standard Algebraic Notation.
Variants
NormalFields of Normal
Castle(CastlingSide)PutFields of Put
NullMethods
impl San[src]
pub fn from_ascii(san: &[u8]) -> Result<San, ParseSanError>[src]
Parses a SAN. Ignores a possible check or checkmate suffix.
Errors
Returns ParseSanError if san is not syntactically valid.
pub fn from_move<P>(pos: &P, m: &Move) -> San where
P: Position, [src]
P: Position,
Converts a move to Standard Algebraic Notation.
pub fn to_move<P>(&self, pos: &P) -> Result<Move, SanError> where
P: Position, [src]
P: Position,
Tries to convert the San to a legal move in the context of a
position.
Errors
Returns SanError if there is no unique matching legal move.
pub fn disambiguate(m: &Move, moves: &ArrayVec<[Move; 512]>) -> San[src]
pub fn find_move(
&self,
moves: &'a ArrayVec<[Move; 512]>
) -> Result<&'a Move, SanError>[src]
&self,
moves: &'a ArrayVec<[Move; 512]>
) -> Result<&'a Move, SanError>
Searches a MoveList for a unique matching move.
Errors
Returns SanError if there is no unique matching legal move.
pub fn matches(&self, m: &Move) -> bool[src]
Test if the San can match the Move (in any position).
Examples
use shakmaty::{Square, Role, Move}; use shakmaty::san::San; let m = Move::Normal { role: Role::Knight, from: Square::G1, to: Square::F3, capture: None, promotion: None, }; let nf3 = San::from_ascii(b"Nf3")?; assert!(nf3.matches(&m)); let ng1f3 = San::from_ascii(b"Ng1f3")?; assert!(ng1f3.matches(&m)); // capture does not match let nxf3 = San::from_ascii(b"Nxf3")?; assert!(!nxf3.matches(&m)); // other file does not match let nef3 = San::from_ascii(b"Nef3")?; assert!(!nef3.matches(&m));
Trait Implementations
impl PartialEq<San> for San[src]
impl Display for San[src]
impl FromStr for San[src]
type Err = ParseSanError
The associated error which can be returned from parsing.
fn from_str(san: &str) -> Result<San, ParseSanError>[src]
impl Clone for San[src]
fn clone(&self) -> San[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for San[src]
impl Eq for San[src]
impl Hash for San[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T> From for T[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,