This commit is contained in:
Eryn Wells 2025-05-08 17:37:51 -07:00
parent d5cdf273c8
commit 091cc99cb3
42 changed files with 805 additions and 1662 deletions

View file

@ -4,6 +4,7 @@ use crate::Board;
use chessfriend_core::{File, Rank, Square};
use std::fmt;
#[must_use]
pub struct DiagramFormatter<'a>(&'a Board);
impl<'a> DiagramFormatter<'a> {
@ -21,8 +22,8 @@ impl<'a> fmt::Display for DiagramFormatter<'a> {
for file in File::ALL {
let square = Square::from_file_rank(file, rank);
match self.0.piece_on_square(square) {
Some(placed_piece) => write!(f, "{} ", placed_piece.piece())?,
match self.0.get_piece(square) {
Some(piece) => write!(f, "{piece} ")?,
None => write!(f, "· ")?,
}
}