pub struct MoveInfoError {
pub error: String,
pub mov: Move,
}Expand description
Errors that can occur when trying to move a Piece
Fields§
§error: StringThe error message
mov: MoveThe move that caused the error
Implementations§
Source§impl MoveInfoError
impl MoveInfoError
Sourcepub fn new(error: String, mov: Move) -> Self
pub fn new(error: String, mov: Move) -> Self
Creates a new MoveInfoError with the given error message and Move
§Arguments
error- The error messagemov- The Move that caused the error
§Example
use chess_lab::core::{Color, PieceType, Position, Move, MoveType, Piece};
let piece = Piece::new(Color::White, PieceType::Pawn);
let from = Position::new(4, 1).unwrap();
let to = Position::new(4, 3).unwrap();
let move_type = MoveType::Normal {
capture: false,
promotion: None,
};
let captured_piece = None;
let rook_from = None;
let ambiguity = (false, false);
let mov = Move::new(
piece,
from,
to,
move_type,
captured_piece,
rook_from,
ambiguity,
false,
false
).unwrap();
let error = MoveInfoError::new("Invalid move".to_string(), mov);Trait Implementations§
Source§impl Debug for MoveInfoError
impl Debug for MoveInfoError
Source§impl Display for MoveInfoError
impl Display for MoveInfoError
Source§impl Error for MoveInfoError
impl Error for MoveInfoError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for MoveInfoError
impl RefUnwindSafe for MoveInfoError
impl Send for MoveInfoError
impl Sync for MoveInfoError
impl Unpin for MoveInfoError
impl UnsafeUnpin for MoveInfoError
impl UnwindSafe for MoveInfoError
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