1
0
Fork 0
This commit is contained in:
Paul-Nicolas Madelaine 2025-11-13 23:10:22 +01:00
parent 01253b66de
commit 457e0c5aff
2 changed files with 4 additions and 0 deletions

View file

@ -11,6 +11,7 @@ use std::iter::ExactSizeIterator;
use std::iter::FusedIterator; use std::iter::FusedIterator;
/// A legal move. /// A legal move.
#[must_use]
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct Move<'l> { pub struct Move<'l> {
position: &'l Position, position: &'l Position,
@ -199,6 +200,7 @@ impl<'l> Move<'l> {
/// ///
/// It can be obtained using the [`Position::legal_moves`] method. This type is an iterator over /// It can be obtained using the [`Position::legal_moves`] method. This type is an iterator over
/// [`Move`] objects. /// [`Move`] objects.
#[must_use]
pub struct Moves<'l> { pub struct Moves<'l> {
position: &'l Position, position: &'l Position,
is_check: bool, is_check: bool,

View file

@ -54,6 +54,7 @@ use std::iter::FusedIterator;
/// The order on [`Position`] is defined only for use in data structures. Hence its only /// The order on [`Position`] is defined only for use in data structures. Hence its only
/// requirement is to be efficient while respecting the [`Ord`] trait protocol. It should not be /// requirement is to be efficient while respecting the [`Ord`] trait protocol. It should not be
/// considered stable. /// considered stable.
#[must_use]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Position(Setup); pub struct Position(Setup);
@ -91,6 +92,7 @@ impl Position {
/// position.legal_moves().len() /// position.legal_moves().len()
/// # }; /// # };
/// ``` /// ```
#[must_use]
#[inline] #[inline]
pub fn count_legal_moves(&self) -> usize { pub fn count_legal_moves(&self) -> usize {
struct MoveGenImpl { struct MoveGenImpl {