chessfriend/board/src/macros.rs

25 lines
618 B
Rust
Raw Normal View History

// Eryn Wells <eryn@erynwells.me>
#[macro_export]
macro_rules! position {
[$($color:ident $shape:ident on $square:ident),* $(,)?] => {
$crate::PositionBuilder::new()
$(.place_piece(piece!($color $shape on $square)))*
.build()
};
}
#[cfg(test)]
#[macro_export]
macro_rules! test_position {
[$($color:ident $shape:ident on $square:ident),* $(,)?] => {
{
let pos = $crate::PositionBuilder::new()
$(.place_piece(piece!($color $shape on $square)))*
.build();
println!("{pos}");
pos
}
};
}