Enum shakmaty::Role [−][src]
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
Implementations
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 Clone for Role
[src]
impl Copy for Role
[src]
impl Debug for Role
[src]
impl Eq for Role
[src]
impl Extend<Role> for MaterialSide
[src]
fn extend<T: IntoIterator<Item = Role>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl FromIterator<Role> for MaterialSide
[src]
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Role>,
[src]
T: IntoIterator<Item = Role>,
impl Hash for Role
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Role
[src]
fn cmp(&self, other: &Role) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Role> for Role
[src]
impl PartialOrd<Role> for Role
[src]
fn partial_cmp(&self, other: &Role) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Role
[src]
impl StructuralPartialEq for Role
[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, Self::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, Self::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, Self::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, Self::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, Self::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, Self::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, Self::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, Self::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, Self::Error>
[src]
impl TryFrom<usize> for Role
[src]
Auto Trait Implementations
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,