Struct shakmaty::RemainingChecks
source · pub struct RemainingChecks(/* private fields */);
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§
source§impl RemainingChecks
impl RemainingChecks
sourcepub const fn new(n: u32) -> RemainingChecks
pub const fn new(n: u32) -> RemainingChecks
pub const fn is_zero(self) -> bool
pub const fn saturating_sub(self, n: u32) -> RemainingChecks
Trait Implementations§
source§impl Clone for RemainingChecks
impl Clone for RemainingChecks
source§fn clone(&self) -> RemainingChecks
fn clone(&self) -> RemainingChecks
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RemainingChecks
impl Debug for RemainingChecks
source§impl Default for RemainingChecks
impl Default for RemainingChecks
source§fn default() -> RemainingChecks
fn default() -> RemainingChecks
Returns the “default value” for a type. Read more
source§impl From<RemainingChecks> for i128
impl From<RemainingChecks> for i128
source§fn from(RemainingChecks: RemainingChecks) -> i128
fn from(RemainingChecks: RemainingChecks) -> i128
Converts to this type from the input type.
source§impl From<RemainingChecks> for i16
impl From<RemainingChecks> for i16
source§fn from(RemainingChecks: RemainingChecks) -> i16
fn from(RemainingChecks: RemainingChecks) -> i16
Converts to this type from the input type.
source§impl From<RemainingChecks> for i32
impl From<RemainingChecks> for i32
source§fn from(RemainingChecks: RemainingChecks) -> i32
fn from(RemainingChecks: RemainingChecks) -> i32
Converts to this type from the input type.
source§impl From<RemainingChecks> for i64
impl From<RemainingChecks> for i64
source§fn from(RemainingChecks: RemainingChecks) -> i64
fn from(RemainingChecks: RemainingChecks) -> i64
Converts to this type from the input type.
source§impl From<RemainingChecks> for i8
impl From<RemainingChecks> for i8
source§fn from(RemainingChecks: RemainingChecks) -> i8
fn from(RemainingChecks: RemainingChecks) -> i8
Converts to this type from the input type.
source§impl From<RemainingChecks> for isize
impl From<RemainingChecks> for isize
source§fn from(RemainingChecks: RemainingChecks) -> isize
fn from(RemainingChecks: RemainingChecks) -> isize
Converts to this type from the input type.
source§impl From<RemainingChecks> for u128
impl From<RemainingChecks> for u128
source§fn from(RemainingChecks: RemainingChecks) -> u128
fn from(RemainingChecks: RemainingChecks) -> u128
Converts to this type from the input type.
source§impl From<RemainingChecks> for u16
impl From<RemainingChecks> for u16
source§fn from(RemainingChecks: RemainingChecks) -> u16
fn from(RemainingChecks: RemainingChecks) -> u16
Converts to this type from the input type.
source§impl From<RemainingChecks> for u32
impl From<RemainingChecks> for u32
source§fn from(RemainingChecks: RemainingChecks) -> u32
fn from(RemainingChecks: RemainingChecks) -> u32
Converts to this type from the input type.
source§impl From<RemainingChecks> for u64
impl From<RemainingChecks> for u64
source§fn from(RemainingChecks: RemainingChecks) -> u64
fn from(RemainingChecks: RemainingChecks) -> u64
Converts to this type from the input type.
source§impl From<RemainingChecks> for u8
impl From<RemainingChecks> for u8
source§fn from(RemainingChecks: RemainingChecks) -> u8
fn from(RemainingChecks: RemainingChecks) -> u8
Converts to this type from the input type.
source§impl From<RemainingChecks> for usize
impl From<RemainingChecks> for usize
source§fn from(RemainingChecks: RemainingChecks) -> usize
fn from(RemainingChecks: RemainingChecks) -> usize
Converts to this type from the input type.
source§impl Hash for RemainingChecks
impl Hash for RemainingChecks
source§impl Ord for RemainingChecks
impl Ord for RemainingChecks
source§fn cmp(&self, other: &RemainingChecks) -> Ordering
fn cmp(&self, other: &RemainingChecks) -> Ordering
1.21.0 · source§fn 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
source§impl PartialEq for RemainingChecks
impl PartialEq for RemainingChecks
source§fn 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 ==
.source§impl PartialOrd for RemainingChecks
impl PartialOrd for RemainingChecks
source§fn partial_cmp(&self, other: &RemainingChecks) -> Option<Ordering>
fn partial_cmp(&self, other: &RemainingChecks) -> Option<Ordering>
1.0.0 · source§fn 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 moresource§impl TryFrom<i128> for RemainingChecks
impl TryFrom<i128> for RemainingChecks
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl 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.
source§impl 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.
source§impl 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.
source§impl 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.
source§impl 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.
source§impl TryFrom<u128> for RemainingChecks
impl TryFrom<u128> for RemainingChecks
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl 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.
source§impl 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.
source§impl 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.
source§impl 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.
source§impl 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 StructuralPartialEq for RemainingChecks
Auto Trait Implementations§
impl Freeze for RemainingChecks
impl RefUnwindSafe for RemainingChecks
impl Send for RemainingChecks
impl Sync for RemainingChecks
impl Unpin for RemainingChecks
impl UnwindSafe for RemainingChecks
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more