[board] Move MakeMoveBuilder::new() to an impl that specifies NoMove

I can build these now without having to specify a type for M.
This commit is contained in:
Eryn Wells 2024-01-22 08:18:19 -08:00
parent bf2bccbc7d
commit 9a8380573b

View file

@ -41,17 +41,19 @@ pub enum ValidatedMove {
impl MoveToMake for NoMove {} impl MoveToMake for NoMove {}
impl MoveToMake for ValidatedMove {} impl MoveToMake for ValidatedMove {}
impl<'p, M> Builder<'p, M> impl<'p> Builder<'p, NoMove> {
where
M: MoveToMake,
{
pub fn new(position: &'p Position) -> Builder<'p, NoMove> { pub fn new(position: &'p Position) -> Builder<'p, NoMove> {
Builder { Builder {
position, position,
move_to_make: NoMove, move_to_make: NoMove,
} }
} }
}
impl<'p, M> Builder<'p, M>
where
M: MoveToMake,
{
pub fn make(self, mv: &Move) -> Result<Builder<'p, ValidatedMove>, MakeMoveError> { pub fn make(self, mv: &Move) -> Result<Builder<'p, ValidatedMove>, MakeMoveError> {
let from_square = mv.from_square(); let from_square = mv.from_square();