[position] Rename fields of EnPassant struct

Append _square to each one.
This commit is contained in:
Eryn Wells 2024-03-01 15:24:20 -08:00
parent 0fc90a4a2e
commit a65fcd6000

View file

@ -5,8 +5,8 @@ use chessfriend_core::{Rank, Square};
/// En passant information. /// En passant information.
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct EnPassant { pub struct EnPassant {
target: Square, target_square: Square,
capture: Square, capture_square: Square,
} }
impl EnPassant { impl EnPassant {
@ -34,18 +34,21 @@ impl EnPassant {
/// ``` /// ```
pub fn from_target_square(target: Square) -> Option<Self> { pub fn from_target_square(target: Square) -> Option<Self> {
match Self::_capture_square(target) { match Self::_capture_square(target) {
Some(capture) => Some(Self { target, capture }), Some(capture) => Some(Self {
target_square: target,
capture_square: capture,
}),
None => None, None => None,
} }
} }
/// The square the capturing piece will move to. /// The square the capturing piece will move to.
pub fn target_square(&self) -> Square { pub fn target_square(&self) -> Square {
self.target self.target_square
} }
/// The square on which the captured pawn sits. /// The square on which the captured pawn sits.
pub fn capture_square(&self) -> Square { pub fn capture_square(&self) -> Square {
self.capture self.capture_square
} }
} }