Struct pgn_reader::Nag
source · pub struct Nag(pub u8);
Expand description
A numeric annotation glyph like ?
, !!
or $42
.
Tuple Fields§
§0: u8
Implementations§
source§impl Nag
impl Nag
sourcepub fn from_ascii(s: &[u8]) -> Result<Nag, InvalidNag>
pub fn from_ascii(s: &[u8]) -> Result<Nag, InvalidNag>
Tries to parse a NAG from ASCII.
Examples
use pgn_reader::Nag;
assert_eq!(Nag::from_ascii(b"??"), Ok(Nag(4)));
assert_eq!(Nag::from_ascii(b"$24"), Ok(Nag(24)));
Errors
Returns an InvalidNag
error if the input is neither a known glyph
(?!
, !
, …) nor a valid numeric annotation ($0
, …, $255
).
sourcepub const BRILLIANT_MOVE: Nag = _
pub const BRILLIANT_MOVE: Nag = _
A brilliant move (!!
).
sourcepub const SPECULATIVE_MOVE: Nag = _
pub const SPECULATIVE_MOVE: Nag = _
A speculative move (!?
).
sourcepub const DUBIOUS_MOVE: Nag = _
pub const DUBIOUS_MOVE: Nag = _
A dubious move (?!
).
Trait Implementations§
source§impl Ord for Nag
impl Ord for Nag
source§impl PartialOrd<Nag> for Nag
impl PartialOrd<Nag> for Nag
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more