From 5d2129b797a46c902b4a0379df6885ef15b1eafa Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Wed, 26 Nov 2025 23:03:23 +0100 Subject: [PATCH] impl Clone for Moves<'l> --- src/array_vec.rs | 13 +++++++++++++ src/moves.rs | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/array_vec.rs b/src/array_vec.rs index d6ad5ae..c940f80 100644 --- a/src/array_vec.rs +++ b/src/array_vec.rs @@ -7,6 +7,19 @@ pub(crate) struct ArrayVec { array: [MaybeUninit; N], } +impl Clone for ArrayVec +where + T: Copy, +{ + #[inline] + fn clone(&self) -> Self { + Self { + len: self.len, + array: self.array.clone(), + } + } +} + impl ArrayVec { #[inline] pub(crate) fn new() -> Self { diff --git a/src/moves.rs b/src/moves.rs index 14ba2c0..0db6324 100644 --- a/src/moves.rs +++ b/src/moves.rs @@ -208,6 +208,7 @@ impl<'l> Move<'l> { /// Even though the [`Position`] type can represent more positions than just reachable positions, /// the proof still holds, as its definition of a position is even less restrictive. #[must_use] +#[derive(Clone)] pub struct Moves<'l> { position: &'l Position, is_check: bool, @@ -345,6 +346,7 @@ impl<'l> Moves<'l> { } /// An iterator over legal moves. +#[derive(Clone)] pub struct MovesIter<'l> { position: &'l Position, iter: core::slice::Iter<'l, RawMove>,