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 for Nag
impl PartialOrd 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 moreimpl Eq for Nag
impl StructuralPartialEq for Nag
Auto Trait Implementations§
impl Freeze for Nag
impl RefUnwindSafe for Nag
impl Send for Nag
impl Sync for Nag
impl Unpin for Nag
impl UnwindSafe for Nag
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more