Struct shakmaty::RemainingChecks
source · [−]pub struct RemainingChecks(_);
Expand description
The number of checks the respective side needs to give in order to win (in a game of Three-Check).
Examples
use shakmaty::{ByColor, RemainingChecks};
let mut remaining_checks = ByColor::<RemainingChecks>::default();
assert_eq!(remaining_checks.white, RemainingChecks::new(3));
assert_eq!(remaining_checks.black, RemainingChecks::new(3));
for _ in 0..5 {
remaining_checks.white = remaining_checks.white.saturating_sub(1);
}
assert!(remaining_checks.white.is_zero());
Implementations
sourceimpl RemainingChecks
impl RemainingChecks
sourcepub fn new(n: u32) -> RemainingChecks
pub fn new(n: u32) -> RemainingChecks
pub fn is_zero(self) -> bool
pub fn saturating_sub(self, n: u32) -> RemainingChecks
Trait Implementations
sourceimpl Clone for RemainingChecks
impl Clone for RemainingChecks
sourcefn clone(&self) -> RemainingChecks
fn clone(&self) -> RemainingChecks
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 more
sourceimpl Debug for RemainingChecks
impl Debug for RemainingChecks
sourceimpl Default for RemainingChecks
impl Default for RemainingChecks
sourcefn default() -> RemainingChecks
fn default() -> RemainingChecks
Returns the “default value” for a type. Read more
sourceimpl From<RemainingChecks> for i16
impl From<RemainingChecks> for i16
sourcefn from(RemainingChecks: RemainingChecks) -> i16
fn from(RemainingChecks: RemainingChecks) -> i16
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for i32
impl From<RemainingChecks> for i32
sourcefn from(RemainingChecks: RemainingChecks) -> i32
fn from(RemainingChecks: RemainingChecks) -> i32
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for i64
impl From<RemainingChecks> for i64
sourcefn from(RemainingChecks: RemainingChecks) -> i64
fn from(RemainingChecks: RemainingChecks) -> i64
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for i8
impl From<RemainingChecks> for i8
sourcefn from(RemainingChecks: RemainingChecks) -> i8
fn from(RemainingChecks: RemainingChecks) -> i8
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for isize
impl From<RemainingChecks> for isize
sourcefn from(RemainingChecks: RemainingChecks) -> isize
fn from(RemainingChecks: RemainingChecks) -> isize
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for u16
impl From<RemainingChecks> for u16
sourcefn from(RemainingChecks: RemainingChecks) -> u16
fn from(RemainingChecks: RemainingChecks) -> u16
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for u32
impl From<RemainingChecks> for u32
sourcefn from(RemainingChecks: RemainingChecks) -> u32
fn from(RemainingChecks: RemainingChecks) -> u32
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for u64
impl From<RemainingChecks> for u64
sourcefn from(RemainingChecks: RemainingChecks) -> u64
fn from(RemainingChecks: RemainingChecks) -> u64
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for u8
impl From<RemainingChecks> for u8
sourcefn from(RemainingChecks: RemainingChecks) -> u8
fn from(RemainingChecks: RemainingChecks) -> u8
Converts to this type from the input type.
sourceimpl From<RemainingChecks> for usize
impl From<RemainingChecks> for usize
sourcefn from(RemainingChecks: RemainingChecks) -> usize
fn from(RemainingChecks: RemainingChecks) -> usize
Converts to this type from the input type.
sourceimpl Hash for RemainingChecks
impl Hash for RemainingChecks
sourceimpl Ord for RemainingChecks
impl Ord for RemainingChecks
sourcefn cmp(&self, other: &RemainingChecks) -> Ordering
fn cmp(&self, other: &RemainingChecks) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<RemainingChecks> for RemainingChecks
impl PartialEq<RemainingChecks> for RemainingChecks
sourcefn eq(&self, other: &RemainingChecks) -> bool
fn eq(&self, other: &RemainingChecks) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl PartialOrd<RemainingChecks> for RemainingChecks
impl PartialOrd<RemainingChecks> for RemainingChecks
sourcefn partial_cmp(&self, other: &RemainingChecks) -> Option<Ordering>
fn partial_cmp(&self, other: &RemainingChecks) -> 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
sourceimpl TryFrom<i16> for RemainingChecks
impl TryFrom<i16> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<i32> for RemainingChecks
impl TryFrom<i32> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<i64> for RemainingChecks
impl TryFrom<i64> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<i8> for RemainingChecks
impl TryFrom<i8> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<isize> for RemainingChecks
impl TryFrom<isize> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<u16> for RemainingChecks
impl TryFrom<u16> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<u32> for RemainingChecks
impl TryFrom<u32> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<u64> for RemainingChecks
impl TryFrom<u64> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<u8> for RemainingChecks
impl TryFrom<u8> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
sourceimpl TryFrom<usize> for RemainingChecks
impl TryFrom<usize> for RemainingChecks
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
impl Copy for RemainingChecks
impl Eq for RemainingChecks
impl StructuralEq for RemainingChecks
impl StructuralPartialEq for RemainingChecks
Auto Trait Implementations
impl RefUnwindSafe for RemainingChecks
impl Send for RemainingChecks
impl Sync for RemainingChecks
impl Unpin for RemainingChecks
impl UnwindSafe for RemainingChecks
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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