[board] A couple small changes to support the explorer crate
- DiagramFormatter::new - Make board::position public
This commit is contained in:
parent
f340578cf2
commit
72dabfe73f
2 changed files with 7 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
mod bitboard;
|
mod bitboard;
|
||||||
mod moves;
|
mod moves;
|
||||||
pub mod piece;
|
pub mod piece;
|
||||||
mod position;
|
pub mod position;
|
||||||
mod square;
|
mod square;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@ use std::fmt::Write;
|
||||||
|
|
||||||
pub struct DiagramFormatter<'a>(&'a Position);
|
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> {
|
impl<'a> fmt::Display for DiagramFormatter<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let mut output = String::new();
|
let mut output = String::new();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue