Improve 'board::BitboardIterator'
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
* Accurate 'size_hint'. * Exact size. * Fused iterator (keeps returning 'None' after returning 'None' once).
This commit is contained in:
parent
7c8dce8f49
commit
b3222276ab
|
@ -14,4 +14,14 @@ impl Iterator for BitboardIterator {
|
|||
Some(crate::board::Square::from_index(lsb))
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let size = self.0.count_ones() as usize;
|
||||
|
||||
(size, Some(size))
|
||||
}
|
||||
}
|
||||
|
||||
impl ExactSizeIterator for BitboardIterator {}
|
||||
|
||||
impl std::iter::FusedIterator for BitboardIterator {}
|
||||
|
|
Loading…
Reference in a new issue