Struct pikadick::database::model::TicTacToeGame
source · pub struct TicTacToeGame {
pub board: Board,
pub x_player: TicTacToePlayer,
pub o_player: TicTacToePlayer,
}
Expand description
A Tic-Tac-Toe game
Fields§
§board: Board
The game board
x_player: TicTacToePlayer
The x player
o_player: TicTacToePlayer
The o player
Implementations§
source§impl TicTacToeGame
impl TicTacToeGame
sourcepub(super) fn new(x_player: TicTacToePlayer, o_player: TicTacToePlayer) -> Self
pub(super) fn new(x_player: TicTacToePlayer, o_player: TicTacToePlayer) -> Self
Make a new TicTacToeGame
.
sourcepub fn get_team_turn(&self) -> Team
pub fn get_team_turn(&self) -> Team
Get whos turn it is
sourcepub fn get_player(&self, team: Team) -> TicTacToePlayer
pub fn get_player(&self, team: Team) -> TicTacToePlayer
Get the player for the given team.
sourcepub fn get_player_turn(&self) -> TicTacToePlayer
pub fn get_player_turn(&self) -> TicTacToePlayer
Get the player whos turn it is
sourcepub fn get_opponent(&self, player: TicTacToePlayer) -> Option<TicTacToePlayer>
pub fn get_opponent(&self, player: TicTacToePlayer) -> Option<TicTacToePlayer>
Get the opponent of the given user in this TicTacToeGame
.
sourcepub fn iter_players(&self) -> impl Iterator<Item = TicTacToePlayer> + '_
pub fn iter_players(&self) -> impl Iterator<Item = TicTacToePlayer> + '_
Iterate over all TicTacToePlayer
s.
Order is X player, O player.
This will include computer players.
Convert players into UserId
s and filter if you want human players.
Trait Implementations§
source§impl Clone for TicTacToeGame
impl Clone for TicTacToeGame
source§fn clone(&self) -> TicTacToeGame
fn clone(&self) -> TicTacToeGame
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TicTacToeGame
impl Debug for TicTacToeGame
impl Copy for TicTacToeGame
Auto Trait Implementations§
impl RefUnwindSafe for TicTacToeGame
impl Send for TicTacToeGame
impl Sync for TicTacToeGame
impl Unpin for TicTacToeGame
impl UnwindSafe for TicTacToeGame
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
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
§impl<T> CloneableStorage for Twhere
T: Any + Send + Sync + Clone,
impl<T> CloneableStorage for Twhere T: Any + Send + Sync + Clone,
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request