shuuro/shuuro_rules/
bitboard.rs

1use std::{
2    fmt::{Debug, Display},
3    ops::{
4        BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not,
5    },
6};
7
8use crate::shuuro_rules::Square;
9
10pub trait BitBoard<S: Square>:
11    Sized
12    + Clone
13    + Copy
14    + Debug
15    + Not
16    + Default
17    + Display
18    + for<'a> BitAndAssign<&'a Self>
19    + for<'a> BitOrAssign<&'a Self>
20    + for<'a> BitXor<&'a Self, Output = Self>
21    + for<'a> BitXorAssign<&'a Self>
22    + for<'a> BitOr<&'a Self, Output = Self>
23    + for<'a> BitAnd<&'a Self, Output = Self>
24    + for<'a> Not<Output = Self>
25    + for<'a> BitOr<&'a S, Output = Self>
26    + for<'a> BitAnd<&'a S, Output = Self>
27    + for<'a> BitOrAssign<&'a S>
28    + for<'a> PartialEq<Self>
29    + Iterator<Item = S>
30{
31    fn empty() -> Self;
32    fn full() -> Self;
33    fn is_any(&self) -> bool;
34    fn is_empty(&self) -> bool;
35    fn clear_at(&mut self, sq: S);
36    fn clear_all(&mut self);
37    fn len(&self) -> u32;
38    fn set_all(&mut self);
39    fn pop(&mut self) -> Option<S>;
40    fn pop_reverse(&mut self) -> Option<S>;
41    fn from_square(sq: &S) -> Self;
42}