diff options
Diffstat (limited to 'protocol/src')
-rw-r--r-- | protocol/src/bridge_engine.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/protocol/src/bridge_engine.rs b/protocol/src/bridge_engine.rs index 44e5c91..d04bdf0 100644 --- a/protocol/src/bridge_engine.rs +++ b/protocol/src/bridge_engine.rs @@ -1009,6 +1009,17 @@ impl Default for TableState { } } +impl TryFrom<TableState> for GameState { + type Error = anyhow::Error; + + fn try_from(value: TableState) -> Result<Self, Self::Error> { + match value { + TableState::Game(game) => Ok(game), + _ => Err(anyhow::anyhow!("no game")), + } + } +} + impl From<MoveResult<GameState, PlayResult>> for TableState { fn from(val: MoveResult<GameState, PlayResult>) -> Self { match val { |