Struct shakmaty::MaterialSide
source · pub struct MaterialSide {
pub pawns: u8,
pub knights: u8,
pub bishops: u8,
pub rooks: u8,
pub queens: u8,
pub kings: u8,
}
Expand description
The material configuration of one side.
Fields
pawns: u8
knights: u8
bishops: u8
rooks: u8
queens: u8
kings: u8
Implementations
sourceimpl MaterialSide
impl MaterialSide
pub fn new() -> MaterialSide
pub fn by_role(&self, role: Role) -> u8
pub fn by_role_mut(&mut self, role: Role) -> &mut u8
pub fn count(&self) -> usize
pub fn has_pawns(&self) -> bool
pub fn from_ascii(s: &[u8]) -> Result<MaterialSide, ParseMaterialError>
Trait Implementations
sourceimpl Clone for MaterialSide
impl Clone for MaterialSide
sourcefn clone(&self) -> MaterialSide
fn clone(&self) -> MaterialSide
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for MaterialSide
impl Debug for MaterialSide
sourceimpl Default for MaterialSide
impl Default for MaterialSide
sourcefn default() -> MaterialSide
fn default() -> MaterialSide
Returns the “default value” for a type. Read more
sourceimpl Display for MaterialSide
impl Display for MaterialSide
sourceimpl Extend<Role> for MaterialSide
impl Extend<Role> for MaterialSide
sourcefn extend<T: IntoIterator<Item = Role>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Role>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl FromIterator<Role> for MaterialSide
impl FromIterator<Role> for MaterialSide
sourcefn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = Role>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = Role>,
Creates a value from an iterator. Read more
sourceimpl FromStr for MaterialSide
impl FromStr for MaterialSide
type Err = ParseMaterialError
type Err = ParseMaterialError
The associated error which can be returned from parsing.
sourcefn from_str(s: &str) -> Result<MaterialSide, ParseMaterialError>
fn from_str(s: &str) -> Result<MaterialSide, ParseMaterialError>
Parses a string
s
to return a value of this type. Read moresourceimpl Hash for MaterialSide
impl Hash for MaterialSide
sourceimpl Ord for MaterialSide
impl Ord for MaterialSide
sourcefn cmp(&self, other: &MaterialSide) -> Ordering
fn cmp(&self, other: &MaterialSide) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<MaterialSide> for MaterialSide
impl PartialEq<MaterialSide> for MaterialSide
sourcefn eq(&self, other: &MaterialSide) -> bool
fn eq(&self, other: &MaterialSide) -> bool
sourceimpl PartialOrd<MaterialSide> for MaterialSide
impl PartialOrd<MaterialSide> for MaterialSide
sourcefn partial_cmp(&self, other: &MaterialSide) -> Option<Ordering>
fn partial_cmp(&self, other: &MaterialSide) -> Option<Ordering>
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 moreimpl Eq for MaterialSide
impl StructuralEq for MaterialSide
impl StructuralPartialEq for MaterialSide
Auto Trait Implementations
impl RefUnwindSafe for MaterialSide
impl Send for MaterialSide
impl Sync for MaterialSide
impl Unpin for MaterialSide
impl UnwindSafe for MaterialSide
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more