pub struct MoveByMoveEncoder<'a> {
pub pos: Chess,
pub result: EncodedGame,
/* private fields */
}Expand description
An encoder that lets you add moves one-by-one, rather than a whole game at once.
§Examples
use shakmaty::Move;
let moves: Vec<Move> = vec![ /* ... */ ];
let mut encoder = MoveByMoveEncoder::new();
for m in moves {
encoder.add_move(m)?;
}Fields§
§pos: ChessThe current chess position.
result: EncodedGameThe resulting encoded game.
Implementations§
Source§impl MoveByMoveEncoder<'_>
impl MoveByMoveEncoder<'_>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new MoveByMoveEncoder.
Sourcepub fn add_move(&mut self, m: Move) -> EncodeResult<()>
pub fn add_move(&mut self, m: Move) -> EncodeResult<()>
Adds a new move to the encoder. This affects the value of buffer.
§Errors
GameEncodeError if the move is invalid or pos is an invalid chess position.
§Examples
use shakmaty::Move;
let moves: Vec<Move> = vec![ /* ... */ ];
let mut encoder = MoveByMoveEncoder::new();
for m in moves {
encoder.add_move(m)?;
}Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MoveByMoveEncoder<'a>
impl<'a> RefUnwindSafe for MoveByMoveEncoder<'a>
impl<'a> Send for MoveByMoveEncoder<'a>
impl<'a> Sync for MoveByMoveEncoder<'a>
impl<'a> Unpin for MoveByMoveEncoder<'a>
impl<'a> UnwindSafe for MoveByMoveEncoder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more