Skip to content

Instantly share code, notes, and snippets.

@FermiDirak
Created January 16, 2022 07:42
Show Gist options
  • Save FermiDirak/aa6c10e0b2af962d53848b2188c8c626 to your computer and use it in GitHub Desktop.
Save FermiDirak/aa6c10e0b2af962d53848b2188c8c626 to your computer and use it in GitHub Desktop.
// consuming `apply_move` immutably
let chess_state = Chess::starting_board();
let player_move = Move { start: ('G', 1), end: ('F', 3) };
let next_state = {
let mut next_state = chess_state.clone();
next_state.apply_move(player_move);
next_state
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment