[board] A couple small changes to support the explorer crate

- DiagramFormatter::new
- Make board::position public
This commit is contained in:
Eryn Wells 2023-12-28 15:11:57 -07:00
parent f340578cf2
commit 72dabfe73f
2 changed files with 7 additions and 1 deletions

View file

@ -3,7 +3,7 @@
mod bitboard;
mod moves;
pub mod piece;
mod position;
pub mod position;
mod square;
#[cfg(test)]

View file

@ -6,6 +6,12 @@ use std::fmt::Write;
pub struct DiagramFormatter<'a>(&'a Position);
impl<'a> DiagramFormatter<'a> {
pub fn new(position: &'a Position) -> DiagramFormatter {
DiagramFormatter(position)
}
}
impl<'a> fmt::Display for DiagramFormatter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut output = String::new();