Add 'BitboardIterator::new'
This commit is contained in:
parent
06087358de
commit
3b1735da79
|
@ -1,6 +1,14 @@
|
|||
/// An [Iterator](std::iter::Iterator) of [Square](crate::board::Square) contained in a
|
||||
/// [Bitboard](crate::board::Bitboard).
|
||||
pub struct BitboardIterator(pub(crate) u64);
|
||||
/// [Bitboard].
|
||||
use crate::board::Bitboard;
|
||||
|
||||
pub struct BitboardIterator(u64);
|
||||
|
||||
impl BitboardIterator {
|
||||
pub fn new(board: Bitboard) -> Self {
|
||||
Self(board.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for BitboardIterator {
|
||||
type Item = crate::board::Square;
|
||||
|
|
|
@ -91,7 +91,7 @@ impl IntoIterator for Bitboard {
|
|||
type Item = Square;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
BitboardIterator(self.0)
|
||||
BitboardIterator::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue