Struct pgn_reader::Nag
source · [−]pub struct Nag(pub u8);
Expand description
A numeric annotation glyph like ?
, !!
or $42
.
Tuple Fields
0: u8
Implementations
sourceimpl 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
sourceimpl Ord for Nag
impl Ord for Nag
sourceimpl PartialOrd<Nag> for Nag
impl PartialOrd<Nag> for Nag
sourcefn partial_cmp(&self, other: &Nag) -> Option<Ordering>
fn partial_cmp(&self, other: &Nag) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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
impl Eq for Nag
impl StructuralEq for Nag
impl StructuralPartialEq for Nag
Auto Trait Implementations
impl RefUnwindSafe for Nag
impl Send for Nag
impl Sync for Nag
impl Unpin for Nag
impl UnwindSafe for Nag
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more