[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:
parent
bf2bccbc7d
commit
9a8380573b
1 changed files with 6 additions and 4 deletions
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue