1
0
Fork 0

update ArrayVec

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-17 22:07:04 +01:00
parent 00261d95c1
commit 7d7884326c
2 changed files with 19 additions and 59 deletions

View file

@ -256,7 +256,7 @@ impl<'l> Moves<'l> {
pub fn iter(&'l self) -> MovesIter<'l> {
MovesIter {
position: self.position,
iter: (&self.array).into_iter(),
iter: self.array.as_slice().into_iter(),
}
}
@ -301,7 +301,7 @@ impl<'l> Moves<'l> {
where
F: FnMut(Move, Move) -> core::cmp::Ordering,
{
self.array.as_slice_mut().sort_unstable_by(|a, b| {
self.array.as_mut_slice().sort_unstable_by(|a, b| {
compare(
Move {
position: self.position,
@ -319,7 +319,7 @@ impl<'l> Moves<'l> {
/// An iterator over legal moves.
pub struct MovesIter<'l> {
position: &'l Position,
iter: ArrayVecIter<'l, RawMove, MAX_LEGAL_MOVES>,
iter: core::slice::Iter<'l, RawMove>,
}
impl<'l> Iterator for MovesIter<'l> {
type Item = Move<'l>;
@ -327,7 +327,7 @@ impl<'l> Iterator for MovesIter<'l> {
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(|raw| Move {
position: self.position,
raw,
raw: *raw,
})
}
}