[−][src]Enum pgn_reader::San
A move in Standard Algebraic Notation.
Variants
Normal
Fields of Normal
Castle(CastlingSide)
Put
Fields of Put
Null
Methods
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 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 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 Eq for San
[src]
impl PartialEq<San> for San
[src]
impl Display for San
[src]
impl Hash for San
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for San
[src]
Auto Trait Implementations
impl Sync for San
impl Send for San
impl Unpin for San
impl RefUnwindSafe for San
impl UnwindSafe for San
Blanket Implementations
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,