[−][src]Enum pgn_reader::Role
Piece types: Pawn
, Knight
, Bishop
, Rook
, Queen
, King
.
Examples
use shakmaty::Role; // Piece types are indexed from 1 to 6. assert_eq!(u32::from(Role::Pawn), 1); assert_eq!(u32::from(Role::King), 6);
Variants
Pawn
Knight
Bishop
Rook
Queen
King
Methods
impl Role
[src]
pub fn from_char(ch: char) -> Option<Role>
[src]
Gets the piece type from its English letter.
Examples
use shakmaty::Role; assert_eq!(Role::from_char('K'), Some(Role::King)); assert_eq!(Role::from_char('n'), Some(Role::Knight)); assert_eq!(Role::from_char('X'), None);
pub fn of(self, color: Color) -> Piece
[src]
Gets a Piece
of the given color.
Examples
use shakmaty::{Color, Role}; assert_eq!(Role::King.of(Color::Black), Color::Black.king());
pub fn char(self) -> char
[src]
Gets the English letter for the piece type.
Examples
use shakmaty::Role; assert_eq!(Role::Rook.char(), 'r');
pub fn upper_char(self) -> char
[src]
Gets the uppercase English letter for the piece type.
Examples
use shakmaty::Role; assert_eq!(Role::Rook.upper_char(), 'R');
Trait Implementations
impl PartialEq<Role> for Role
[src]
fn eq(&self, other: &Role) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Clone for Role
[src]
fn clone(&self) -> Role
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialOrd<Role> for Role
[src]
fn partial_cmp(&self, other: &Role) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Role
[src]
impl Copy for Role
[src]
impl Eq for Role
[src]
impl TryFrom<u128> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: u128) -> Result<Role, <Role as TryFrom<u128>>::Error>
[src]
impl TryFrom<u32> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: u32) -> Result<Role, <Role as TryFrom<u32>>::Error>
[src]
impl TryFrom<u16> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: u16) -> Result<Role, <Role as TryFrom<u16>>::Error>
[src]
impl TryFrom<usize> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: usize) -> Result<Role, <Role as TryFrom<usize>>::Error>
[src]
impl TryFrom<i32> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: i32) -> Result<Role, <Role as TryFrom<i32>>::Error>
[src]
impl TryFrom<i64> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: i64) -> Result<Role, <Role as TryFrom<i64>>::Error>
[src]
impl TryFrom<u8> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: u8) -> Result<Role, <Role as TryFrom<u8>>::Error>
[src]
impl TryFrom<isize> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: isize) -> Result<Role, <Role as TryFrom<isize>>::Error>
[src]
impl TryFrom<i128> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: i128) -> Result<Role, <Role as TryFrom<i128>>::Error>
[src]
impl TryFrom<u64> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: u64) -> Result<Role, <Role as TryFrom<u64>>::Error>
[src]
impl TryFrom<i16> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: i16) -> Result<Role, <Role as TryFrom<i16>>::Error>
[src]
impl TryFrom<i8> for Role
[src]
type Error = TryFromIntError
The type returned in the event of a conversion error.
fn try_from(value: i8) -> Result<Role, <Role as TryFrom<i8>>::Error>
[src]
impl Hash for Role
[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 Ord for Role
[src]
fn cmp(&self, other: &Role) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more
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> 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>,