Skip to main content

Bitboard

Struct Bitboard 

Source
pub struct Bitboard(pub u64);

Tuple Fields§

§0: u64

Implementations§

Source§

impl Bitboard

Bitboard Construction API.

Source

pub const fn from_file(file: File) -> Bitboard

Source

pub const fn from_rank(rank: Rank) -> Bitboard

Source

pub const fn from_square(square: Square) -> Bitboard

Source

pub const fn from_squares<const N: usize>(squares: [Square; N]) -> Bitboard

Source§

impl Bitboard

Bitboard Set API.

Source

pub const fn append(&mut self, squares: Bitboard)

Appends squares.

Source

pub const fn clear(&mut self)

Source

pub const fn contains(self, square: Square) -> bool

Source

pub const fn difference(self, squares: Bitboard) -> Bitboard

Source

pub const fn eq(self, other: Self) -> bool

Source

pub const fn first(self) -> Option<Square>

Source

pub const fn insert(&mut self, square: Square) -> bool

Source

pub const fn intersection(self, squares: Bitboard) -> Bitboard

Source

pub const fn is_disjoint(self, other: Bitboard) -> bool

Source

pub const fn is_empty(self) -> bool

Source

pub const fn is_subset(self, other: Bitboard) -> bool

Source

pub const fn is_superset(self, other: Bitboard) -> bool

Source

pub const fn iter(self) -> IntoIter

Source

pub const fn last(self) -> Option<Square>

Source

pub const fn len(self) -> usize

Source

pub const fn pop_first(&mut self) -> Option<Square>

Source

pub const fn pop_last(&mut self) -> Option<Square>

Source

pub const fn remove(&mut self, square: Square) -> bool

Source

pub const fn symmetric_difference(self, squares: Bitboard) -> Bitboard

Source

pub const fn union(self, squares: Bitboard) -> Bitboard

Source§

impl Bitboard

Set extensions

Source

pub const fn more_than_one(self) -> bool

Source

pub const fn next_subset(self, set: Bitboard) -> Bitboard

Returns the next subset of self after set, wrapping back to empty.

set is expected to be a subset of self.

Source

pub const fn set(&mut self, square: Square, set: bool)

Source

pub const fn with(self, square: Square) -> Bitboard

Source

pub const fn without_first(self) -> Bitboard

Source§

impl Bitboard

Bitboard Geometry API.

Source

pub const fn checked_shift(self, direction: Direction) -> Bitboard

Source

pub const fn flip_anti_diagonal(self) -> Bitboard

Mirror at h1-a8 diagonal

Source

pub const fn flip_diagonal(self) -> Bitboard

Mirror at a1-h8 diagonal

Source

pub const fn flip_horizontal(self) -> Bitboard

Source

pub const fn flip_vertical(self) -> Bitboard

Source

pub const fn rotate_180(self) -> Bitboard

Source

pub const fn rotate_270(self) -> Bitboard

Source

pub const fn rotate_90(self) -> Bitboard

Source

pub const fn without_a_file(self) -> Bitboard

Source

pub const fn without_ab_files(self) -> Bitboard

Source

pub const fn without_gh_files(self) -> Bitboard

Source

pub const fn without_h_file(self) -> Bitboard

Source§

impl Bitboard

Constants

Trait Implementations§

Source§

impl Binary for Bitboard

Source§

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

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

impl<T> BitAnd<T> for Bitboard
where T: Into<Bitboard>,

Source§

type Output = Bitboard

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: T) -> Bitboard

Performs the & operation. Read more
Source§

impl<T> BitAndAssign<T> for Bitboard
where T: Into<Bitboard>,

Source§

fn bitand_assign(&mut self, rhs: T)

Performs the &= operation. Read more
Source§

impl<T> BitOr<T> for Bitboard
where T: Into<Bitboard>,

Source§

type Output = Bitboard

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: T) -> Bitboard

Performs the | operation. Read more
Source§

impl<T> BitOrAssign<T> for Bitboard
where T: Into<Bitboard>,

Source§

fn bitor_assign(&mut self, rhs: T)

Performs the |= operation. Read more
Source§

impl<T> BitXor<T> for Bitboard
where T: Into<Bitboard>,

Source§

type Output = Bitboard

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: T) -> Bitboard

Performs the ^ operation. Read more
Source§

impl<T> BitXorAssign<T> for Bitboard
where T: Into<Bitboard>,

Source§

fn bitxor_assign(&mut self, rhs: T)

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 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Bitboard

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() -> Bitboard

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

impl Eq for Bitboard

Source§

impl Extend<Square> for Bitboard

Source§

fn extend<T: IntoIterator<Item = Square>>(&mut self, iter: T)

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

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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
Source§

impl From<Bitboard> for u64

Source§

fn from(bitboard: Bitboard) -> u64

Converts to this type from the input type.
Source§

impl From<File> for Bitboard

Source§

fn from(file: File) -> Bitboard

Converts to this type from the input type.
Source§

impl From<Rank> for Bitboard

Source§

fn from(rank: Rank) -> Bitboard

Converts to this type from the input type.
Source§

impl From<Square> for Bitboard

Source§

fn from(sq: Square) -> Bitboard

Converts to this type from the input type.
Source§

impl From<u64> for Bitboard

Source§

fn from(bitboard: u64) -> Bitboard

Converts to this type from the input type.
Source§

impl FromIterator<Square> for Bitboard

Source§

fn from_iter<T>(iter: T) -> Bitboard
where T: IntoIterator<Item = Square>,

Creates a value from an iterator. Read more
Source§

impl IntoIterator for Bitboard

Source§

type Item = Square

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IntoIter

Creates an iterator from a value. Read more
Source§

impl LowerHex for Bitboard

Source§

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

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

impl Not for Bitboard

Source§

type Output = Bitboard

The resulting type after applying the ! operator.
Source§

fn not(self) -> Bitboard

Performs the unary ! operation. Read more
Source§

impl Octal for Bitboard

Source§

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

Formats the value using the given formatter. 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 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

Restrict a value to a certain interval. Read more
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 (const: unstable) · Source§

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 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 (const: unstable) · Source§

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

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

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 (const: unstable) · Source§

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

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

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 StructuralPartialEq for Bitboard

Source§

impl UpperHex for Bitboard

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.