Struct pleco::board::castle_rights::Castling[]

pub struct Castling { /* fields omitted */ }

Structure to help with recognizing the various possibilities of castling.

For internal use by the Board only.

Keeps track of what sides are possible to castle from for each player.

Does not guarantee that the player containing a castling bit can castle at that time. Rather marks that castling is a possibility, e.g. a Castling struct containing a bit marking WHITE_Q means that neither the White King or Queen-side rook has moved since the game started.

Methods

impl Castling

WHITE_K: Castling = Castling{bits: C_WHITE_K_MASK,}

WHITE_Q: Castling = Castling{bits: C_WHITE_Q_MASK,}

BLACK_K: Castling = Castling{bits: C_BLACK_K_MASK,}

BLACK_Q: Castling = Castling{bits: C_BLACK_Q_MASK,}

WHITE_ALL: Castling = Castling{bits: <Self>::WHITE_K.bits | <Self>::WHITE_Q.bits,}

BLACK_ALL: Castling = Castling{bits: <Self>::BLACK_K.bits | <Self>::BLACK_Q.bits,}

Returns an empty set of flags.

Returns the set containing all flags.

Returns the raw value of the flags currently stored.

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

Returns true if no flags are currently stored.

Returns true if all flags are currently set.

Returns true if there are flags common to both self and other.

Returns true all of the flags in other are contained within self.

Inserts the specified flags in-place.

Removes the specified flags in-place.

Toggles the specified flags in-place.

Inserts or removes the specified flags depending on the passed value.

impl Castling
[src]

Removes all castling possibility for a single player

Removes King-Side castling possibility for a single player

Removes Queen-Side castling possibility for a single player

Returns if a player can castle for a given side

Returns if both players have lost their ability to castle

Adds the Right to castle based on an char.

`K` -> Add White King-side Castling bit.
`Q` -> Add White Queen-side Castling bit.
`k` -> Add Black King-side Castling bit.
`q` -> Add Black Queen-side Castling bit.
`-` -> Do nothing.

Panics

Panics of the char is not K, Q, k, q, or -.

Returns a pretty String representing the castling state

Used for FEN Strings, with (K | Q) representing white castling abilities, and (k | q) representing black castling abilities. If there are no bits set, returns a String containing "-".

Trait Implementations

impl Copy for Castling

impl PartialEq for Castling

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Castling

impl Clone for Castling

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialOrd for Castling

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Castling

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Hash for Castling

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for Castling

Formats the value using the given formatter. Read more

impl Binary for Castling

Formats the value using the given formatter.

impl Octal for Castling

Formats the value using the given formatter.

impl LowerHex for Castling

Formats the value using the given formatter.

impl UpperHex for Castling

Formats the value using the given formatter.

impl BitOr for Castling

The resulting type after applying the | operator.

Returns the union of the two sets of flags.

impl BitOrAssign for Castling

Adds the set of flags.

impl BitXor for Castling

The resulting type after applying the ^ operator.

Returns the left flags, but with all the right flags toggled.

impl BitXorAssign for Castling

Toggles the set of flags.

impl BitAnd for Castling

The resulting type after applying the & operator.

Returns the intersection between the two sets of flags.

impl BitAndAssign for Castling

Disables all flags disabled in the set.

impl Sub for Castling

The resulting type after applying the - operator.

Returns the set difference of the two sets of flags.

impl SubAssign for Castling

Disables all flags enabled in the set.

impl Not for Castling

The resulting type after applying the ! operator.

Returns the complement of this set of flags.

impl Extend<Castling> for Castling

Extends a collection with the contents of an iterator. Read more

impl FromIterator<Castling> for Castling

Creates a value from an iterator. Read more

impl Display for Castling
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Castling

impl Sync for Castling