Bitboard

Struct Bitboard 

Source
pub struct Bitboard(/* private fields */);
Expand description

A 64-bit Bitboard.

Implementations§

Source§

impl Bitboard

Source

pub const fn new(v: u64) -> Self

Create a new Bitboard, containing the value v.

Source

pub const fn full() -> Self

Create a full Bitboard.

§Example
let full = Bitboard::full();
assert_eq!(full, Bitboard::new(0b1111111111111111111111111111111111111111111111111111111111111111));
Source

pub const fn empty() -> Self

Create an empty Bitboard.

§Example
let empty = Bitboard::empty();
assert_eq!(empty, Bitboard::new(0b0000000000000000000000000000000000000000000000000000000000000000));
Source

pub fn with_one(pos: Position) -> Self

Create a Bitboard with pos set to 1.

§Example
let bb = Bitboard::with_one(A7);
assert_eq!(bb, Bitboard::new(0b1000000000000000000000000000000000000000000000000));
//   ABCDEFGH
// 8 00000000
// 7 10000000
// 6 00000000
// 5 00000000
// 4 00000000
// 3 00000000
// 2 00000000
// 1 00000000
Source

pub fn with_ones(positions: impl IntoIterator<Item = Position>) -> Self

Create a Bitboard with all positions in positions set to 1.

§Example
let bb = Bitboard::with_ones([A1, B2, C3, D4, E5, F6, G7, H8]);
assert_eq!(bb, Bitboard::new(0b1000000001000000001000000001000000001000000001000000001000000001));
//   ABCDEFGH
// 8 00000001
// 7 00000010
// 6 00000100
// 5 00001000
// 4 00010000
// 3 00100000
// 2 01000000
// 1 10000000
Source

pub fn bit_at(&self, pos: Position) -> bool

Returns true if the bit at pos is 1, false otherwise.

§Example
let bb = Bitboard::with_one(F2);
assert!(bb.bit_at(F2));
assert!(!bb.bit_at(F3));
Source

pub fn include_position(self, pos: Position) -> Self

Apply a mask to self, only including the bit at pos.

§Example
let bb = Bitboard::with_ones([F2, F3]);
let masked = bb.include_position(F3);
assert_eq!(masked, Bitboard::with_one(F3)); // the bit at F2 is now 0
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000100    3 00000100
// 2 00000100    2 00000000
// 1 00000000    1 00000000
Source

pub fn include_positions( self, positions: impl IntoIterator<Item = Position>, ) -> Self

Apply a mask to self, only including the bits at the given positions.

§Example
let bb = Bitboard::with_ones([F2, F3, F4]);
let masked = bb.include_positions([F3, F4, F5]);
assert_eq!(masked, Bitboard::with_ones([F3, F4])); // neither F2 nor F5 are in the resulting bitboard
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000100    4 00000100
// 3 00000100    3 00000100
// 2 00000100    2 00000000
// 1 00000000    1 00000000
Source

pub fn clear_position(self, pos: Position) -> Self

Apply a mask to self, clearing the bit at position pos.

§Example
let bb = Bitboard::with_ones([F4, F5]);
let cleared = bb.clear_position(F4);
assert_eq!(cleared, Bitboard::with_one(F5)); // F4 has been cleared
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000100 -> 5 00000100
// 4 00000100    4 00000000
// 3 00000000    3 00000000
// 2 00000000    2 00000000
// 1 00000000    1 00000000
Source

pub fn clear_positions( self, positions: impl IntoIterator<Item = Position>, ) -> Self

Apply a mask to self, clearing the bit at each position in positions.

§Example
let bb = Bitboard::with_ones([F2, F3, F4]);
let cleared = bb.clear_positions([F2, F3]);
assert_eq!(cleared, Bitboard::with_one(F4)); // only F4 remains after clearing F2 and F3
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000100    4 00000100
// 3 00000100    3 00000000
// 2 00000100    2 00000000
// 1 00000000    1 00000000
Source

pub fn include_file(self, file: File) -> Self

Apply a mask to self, only including the bits at positions in the given file.

§Example
let bb = Bitboard::with_ones([A1, B1, C1]);
let masked = bb.include_file(File::A);
assert_eq!(masked, Bitboard::with_one(A1)); // B1 and C1 are not in file A
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000000    3 00000000
// 2 00000000    2 00000000
// 1 11100000    1 10000000
Source

pub fn include_files(self, files: impl IntoIterator<Item = File>) -> Self

Apply a mask to self, only including the bits at positions in the given files.

§Example
let bb = Bitboard::with_ones([A1, B1, C1]);
let masked = bb.include_files([File::A, File::B]);
assert_eq!(masked, Bitboard::with_ones([A1, B1])); // C1 is not in file A or B
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000000    3 00000000
// 2 00000000    2 00000000
// 1 11100000    1 11000000
Source

pub fn clear_file(self, file: File) -> Self

Apply a mask to self, setting the bits at positions in the given file to 0.

§Example
let bb = Bitboard::with_ones([C1, C2, B2]);
let cleared = bb.clear_file(File::C);
assert_eq!(cleared, Bitboard::with_one(B2)); // C1 and C2 have been cleared
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000000    3 00000000
// 2 01100000    2 01000000
// 1 00100000    1 00000000
Source

pub fn clear_files(self, files: impl IntoIterator<Item = File>) -> Self

Apply a mask to self, setting the bits at positions in the given files to 0.

§Example
let bb = Bitboard::with_ones([C1, C2, B2, D1]);
let cleared = bb.clear_files([File::C, File::D]);
assert_eq!(cleared, Bitboard::with_one(B2)); // C1, C2 and D1 have been cleared
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000000    3 00000000
// 2 01100000    2 01000000
// 1 00110000    1 00000000
Source

pub fn include_rank(self, rank: Rank) -> Self

Apply a mask to self, only including bits at positions in the given rank.

§Example
let bb = Bitboard::with_ones([A1, A2, G2]);
let rank_two = bb.include_rank(Rank::Two);
assert_eq!(rank_two, Bitboard::with_ones([A2, G2]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000000    3 00000000
// 2 10000010    2 10000010
// 1 10000000    1 00000000
Source

pub fn include_ranks(self, ranks: impl IntoIterator<Item = Rank>) -> Self

Apply a mask to self, only including bits at positions in the given ranks.

§Example
let bb = Bitboard::with_ones([A1, A2, B2, F3]);
let rank_two_and_three = bb.include_ranks([Rank::Two, Rank::Three]);
assert_eq!(rank_two_and_three, Bitboard::with_ones([A2, B2, F3])); // A1 is not in rank two or three
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000100    3 00000100
// 2 11000000    2 11000000
// 1 10000000    1 00000000
Source

pub fn clear_rank(self, rank: Rank) -> Self

Apply a mask to self, setting the bits at positions in the given rank to 0.

§Example
let bb = Bitboard::with_ones([C1, C2, B2]);
let without_rank_1 = bb.clear_rank(Rank::One);
assert_eq!(without_rank_1, Bitboard::with_ones([C2, B2])); // C1 has been cleared
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00000000    3 00000000
// 2 01100000    2 01100000
// 1 00100000    1 00000000
Source

pub fn clear_ranks(self, ranks: impl IntoIterator<Item = Rank>) -> Self

Apply a mask to self, setting the bits at positions in the given ranks to 0.

§Example
let bb = Bitboard::with_ones([C1, C2, B2, D3]);
let cleared = bb.clear_ranks([Rank::Two, Rank::Three]);
assert_eq!(cleared, Bitboard::with_one(C1)); // C2, B2, D3 have been cleared
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 00000000
// 4 00000000    4 00000000
// 3 00010000    3 00000000
// 2 01100000    2 00000000
// 1 00100000    1 00100000
Source

pub fn up_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going straight up to 1.

§Example
let bb = Bitboard::up_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, C6, C7, C8]));
//   ABCDEFGH
// 8 00100000
// 7 00100000
// 6 00100000
// 5 00100000
// 4 00000000
// 3 00000000
// 2 00000000
// 1 00000000
Source

pub fn up_right_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going diagonally up and to the right to 1.

§Example
let bb = Bitboard::up_right_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, D6, E7, F8]));
//   ABCDEFGH
// 8 00000100
// 7 00001000
// 6 00010000
// 5 00100000
// 4 00000000
// 3 00000000
// 2 00000000
// 1 00000000
Source

pub fn right_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going straight to the right to 1.

§Example
let bb = Bitboard::right_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, D5, E5, F5, G5, H5]));
//   ABCDEFGH
// 8 00000000
// 7 00000000
// 6 00000000
// 5 00111111
// 4 00000000
// 3 00000000
// 2 00000000
// 1 00000000
Source

pub fn down_right_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going diagonally down and to the right to 1.

§Example
let bb = Bitboard::down_right_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, D4, E3, F2, G1]));
//   ABCDEFGH
// 8 00000000
// 7 00000000
// 6 00000000
// 5 00100000
// 4 00010000
// 3 00001000
// 2 00000100
// 1 00000010
Source

pub fn down_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going straight down to 1.

§Example
let bb = Bitboard::down_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, C4, C3, C2, C1]));
//   ABCDEFGH
// 8 00000000
// 7 00000000
// 6 00000000
// 5 00100000
// 4 00100000
// 3 00100000
// 2 00100000
// 1 00100000
Source

pub fn down_left_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going diagonally down and to the left to 1.

§Example
let bb = Bitboard::down_left_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, B4, A3]));
//   ABCDEFGH
// 8 00000000
// 7 00000000
// 6 00000000
// 5 00100000
// 4 01000000
// 3 10000000
// 2 00000000
// 1 00000000
Source

pub fn left_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going straight left to 1.

§Example
let bb = Bitboard::left_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, B5, A5]));
//   ABCDEFGH
// 8 00000000
// 7 00000000
// 6 00000000
// 5 11100000
// 4 00000000
// 3 00000000
// 2 00000000
// 1 00000000
Source

pub fn up_left_ray(from: Position) -> Self

Create a Bitboard, setting each bit at positions in a ray starting at from and going diagonally up and to the left to 1.

§Example
let bb = Bitboard::up_left_ray(C5);
assert_eq!(bb, Bitboard::with_ones([C5, B6, A7]));
//   ABCDEFGH
// 8 00000000
// 7 10000000
// 6 01000000
// 5 00100000
// 4 00000000
// 3 00000000
// 2 00000000
// 1 00000000
Source

pub fn white_pawn_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a white pawn on pos.

§Example
let white = Bitboard::with_ones([]); // white has no pieces on the board
let black = Bitboard::with_ones([C5]); // black has a piece at C5
// a white pawn at D4 can either move to C5 (taking blacks piece), or move to D5
assert_eq!(Bitboard::white_pawn_targets(D4, white, black), Bitboard::with_ones([C5, D5]));
Source

pub fn black_pawn_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a black pawn on pos.

§Example
let white = Bitboard::with_ones([C3]); // White has a piece at C3
let black = Bitboard::with_ones([D3]); // Black has a piece at D3
// A black pawn at D4 can move to C3 (taking whites piece). Note that it can't move to D3, since black already has a piece there.
assert_eq!(Bitboard::black_pawn_targets(D4, white, black), Bitboard::with_ones([C3]));
Source

pub fn white_king_targets(pos: Position, white_occupancy: Self) -> Self

Returns a Bitboard describing valid target squares for a white king on pos.

§Example
let white_pieces = Bitboard::with_ones([B4]);
// A white king can move to any square one Manhattan distance step away.
// There is a white piece on B4, which blocks the white king.
assert_eq!(Bitboard::white_king_targets(C4, white_pieces), Bitboard::with_ones([C5, D5, D4, D3, C3, B3, B5]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 01110000
// 4 01x00000    4 00010000
// 3 00000000    3 01110000
// 2 00000000    2 00000000
// 1 00000000    1 00000000
Source

pub fn black_king_targets(pos: Position, black_occupancy: Self) -> Self

Returns a Bitboard describing valid target squares for a black king on pos.

§Example
let black_pieces = Bitboard::with_ones([B4]);
// A black king can move to any square one Manhattan distance step away.
// There is a black piece on B4, which blocks the black king.
assert_eq!(Bitboard::black_king_targets(C4, black_pieces), Bitboard::with_ones([C5, D5, D4, D3, C3, B3, B5]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 00000000
// 5 00000000 -> 5 01110000
// 4 01x00000    4 00010000
// 3 00000000    3 01110000
// 2 00000000    2 00000000
// 1 00000000    1 00000000
Source

pub fn knight_targets(pos: Position, self_occupancy: Self) -> Self

Returns a Bitboard describing valid target squares for a knight on pos.

§Notes

self_occupancy should be a Bitboard representing the pieces with the same color as the given knight.

§Example
let white_pieces = Bitboard::with_ones([A6, C6]);
// a white knight on B4 can't move to A6 or C6 if there are white pieces there
assert_eq!(Bitboard::knight_targets(B4, white_pieces), Bitboard::with_ones([D5, D3, C2, A2]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00000000    6 10100000
// 5 00000000 -> 5 00010000
// 4 01000000    4 00000000
// 3 00000000    3 00010000
// 2 00000000    2 10100000
// 1 00000000    1 00000000
Source

pub fn white_bishop_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a white bishop on pos.

§Example
let white_pieces = Bitboard::with_one(E1);
let black_pieces = Bitboard::with_one(D6);
// a white bishop on B4 can move to any empty square on its diagonals,
// there is a white piece on E1, which blocks the white bishop
// there is a black piece on D6, which the white bishop can take, but not move through
assert_eq!(Bitboard::white_bishop_targets(B4, white_pieces, black_pieces), Bitboard::with_ones([A3, A5, C5, D6, C3, D2]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00010000    6 00010000
// 5 00000000 -> 5 10100000
// 4 0x000000    4 0x000000
// 3 00000000    3 10100000
// 2 00000000    2 00010000
// 1 00000000    1 00000000
Source

pub fn black_bishop_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a black bishop on pos.

§Example
let white_pieces = Bitboard::with_one(D6);
let black_pieces = Bitboard::with_one(D2);
// A black bishop on B4 can move to any empty square on its diagonals.
// There is a black piece on D2, which blocks the black bishop.
// There is a white piece on D6, which the black bishop can take, but not move through.
assert_eq!(Bitboard::black_bishop_targets(B4, white_pieces, black_pieces), Bitboard::with_ones([A3, A5, C5, D6, C3]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00010000    6 00010000
// 5 00000000 -> 5 10100000
// 4 0x000000    4 0x000000
// 3 00000000    3 10100000
// 2 00000000    2 00000000
// 1 00000000    1 00000000
Source

pub fn white_rook_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a white rook on pos.

§Example
let white_pieces = Bitboard::with_one(G4);
let black_pieces = Bitboard::with_one(D6);
// A white rook can move to any empty squares on its cardinals.
// There is a white piece on G4, which blocks the white rook.
// There is a black piece on D6, which the white rook can take, but not move through.
assert_eq!(Bitboard::white_rook_targets(D4, white_pieces, black_pieces), Bitboard::with_ones([A4, B4, C4, D5, D6, D3, D2, D1, E4, F4]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00010000    6 00010000
// 5 00000000 -> 5 00010000
// 4 000x0000    4 11101100
// 3 00000000    3 00010000
// 2 00000000    2 00010000
// 1 00000000    1 00010000
Source

pub fn black_rook_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a black rook on pos.

§Example
let white_pieces = Bitboard::with_one(D6);
let black_pieces = Bitboard::with_one(G4);
// A black rook can move to any empty squares on its cardinals.
// There is a white piece on D6, which the black rook can take, but not move through.
// There is a black piece on G4, which blocks the black rook.
assert_eq!(Bitboard::black_rook_targets(D4, white_pieces, black_pieces), Bitboard::with_ones([A4, B4, C4, D5, D6, D3, D2, D1, E4, F4]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000000
// 7 00000000    7 00000000
// 6 00010000    6 00010000
// 5 00000000 -> 5 00010000
// 4 000x0000    4 11101100
// 3 00000000    3 00010000
// 2 00000000    2 00010000
// 1 00000000    1 00010000
Source

pub fn white_queen_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a white queen on pos.

§Example
let white_pieces = Bitboard::with_one(G4);
let black_pieces = Bitboard::with_one(D6);
// A white queen can move to any empty squares on its cardinals and diagonals.
// There is a black piece on D6, which the white queen can take, but not move through.
// There is a white piece on G4, which blocks the white queen.
assert_eq!(Bitboard::white_queen_targets(D4, white_pieces, black_pieces),
    Bitboard::with_ones([A1, D1, G1, B2, D2, F2, C3, D3, E3, A4, B4, C4, E4, F4, C5, D5, E5, B6, D6, F6, A7, G7, H8]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000001
// 7 00000000    7 10000010
// 6 00010000    6 01010100
// 5 00000000 -> 5 00111000
// 4 000x0000    4 11101100
// 3 00000000    3 00111000
// 2 00000000    2 01010100
// 1 00000000    1 10010010
Source

pub fn black_queen_targets( pos: Position, white_occupancy: Self, black_occupancy: Self, ) -> Self

Returns a Bitboard describing valid target squares for a black queen on pos.

§Example
let white_pieces = Bitboard::with_one(D6);
let black_pieces = Bitboard::with_one(G4);
// A black queen can move to any empty squares on its cardinals and diagonals.
// There is a white piece on D6, which the black queen can take, but not move through.
// There is a black piece on G4, which blocks the black queen.
assert_eq!(Bitboard::black_queen_targets(D4, white_pieces, black_pieces),
    Bitboard::with_ones([A1, D1, G1, B2, D2, F2, C3, D3, E3, A4, B4, C4, E4, F4, C5, D5, E5, B6, D6, F6, A7, G7, H8]));
//   ABCDEFGH      ABCDEFGH
// 8 00000000    8 00000001
// 7 00000000    7 10000010
// 6 00010000    6 01010100
// 5 00000000 -> 5 00111000
// 4 000x0000    4 11101100
// 3 00000000    3 00111000
// 2 00000000    2 01010100
// 1 00000000    1 10010010
Source

pub fn first_position(self) -> Option<Position>

Returns the first position in self where the bit is 1, or None if all bits are 0.

§Notes

Searches in the following order: A1, B1, C1, ..., F8, G8, H8.

§Example
let bb = Bitboard::with_ones([A5, C7, A3]);
assert_eq!(bb.first_position(), Some(A3));
assert_eq!(Bitboard::empty().first_position(), None);
Source

pub fn positions(self) -> HashSet<Position>

Returns a HashSet containing each position in self where the bit is 1.

§Example
let bb = Bitboard::with_ones([A1, C3, D3]);
assert_eq!(bb.positions(), [A1, C3, D3].iter().copied().collect());

Trait Implementations§

Source§

impl Add for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl BitAnd<Position> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Position) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd<u64> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: u64) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAndAssign<Position> for Bitboard

Source§

fn bitand_assign(&mut self, rhs: Position)

Performs the &= operation. Read more
Source§

impl BitAndAssign<u64> for Bitboard

Source§

fn bitand_assign(&mut self, rhs: u64)

Performs the &= operation. Read more
Source§

impl BitAndAssign for Bitboard

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl BitOr<Position> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Position) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr<u64> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: u64) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOrAssign<Position> for Bitboard

Source§

fn bitor_assign(&mut self, rhs: Position)

Performs the |= operation. Read more
Source§

impl BitOrAssign<u64> for Bitboard

Source§

fn bitor_assign(&mut self, rhs: u64)

Performs the |= operation. Read more
Source§

impl BitOrAssign for Bitboard

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl BitXor<Position> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Position) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXor<u64> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: u64) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXor for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXorAssign<Position> for Bitboard

Source§

fn bitxor_assign(&mut self, rhs: Position)

Performs the ^= operation. Read more
Source§

impl BitXorAssign<u64> for Bitboard

Source§

fn bitxor_assign(&mut self, rhs: u64)

Performs the ^= operation. Read more
Source§

impl BitXorAssign for Bitboard

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl Clone for Bitboard

Source§

fn clone(&self) -> Bitboard

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bitboard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Bitboard

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Bitboard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Bitboard> for u64

Source§

fn from(value: Bitboard) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Bitboard

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl Hash for Bitboard

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Not for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Ord for Bitboard

Source§

fn cmp(&self, other: &Bitboard) -> Ordering

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

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<u64> for Bitboard

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Bitboard

Source§

fn eq(&self, other: &Bitboard) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<u64> for Bitboard

Source§

fn partial_cmp(&self, other: &u64) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for Bitboard

Source§

fn partial_cmp(&self, other: &Bitboard) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Shl<u32> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self

Performs the << operation. Read more
Source§

impl Shr<u32> for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> Self

Performs the >> operation. Read more
Source§

impl Sub for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl Copy for Bitboard

Source§

impl Eq for Bitboard

Source§

impl StructuralPartialEq for Bitboard

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.