summaryrefslogtreecommitdiff
path: root/protocol/src/play_result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/src/play_result.rs')
-rw-r--r--protocol/src/play_result.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/protocol/src/play_result.rs b/protocol/src/play_result.rs
index 21961ee..2dba276 100644
--- a/protocol/src/play_result.rs
+++ b/protocol/src/play_result.rs
@@ -1,20 +1,23 @@
-pub enum MoveResult<Stay, Go> {
- Stay(Stay),
- Go(Go),
+use serde::{Serialize, Deserialize};
+
+#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
+pub enum MoveResult<Current, Next> {
+ Current(Current),
+ Next(Next),
}
-impl<Stay, Go> MoveResult<Stay, Go> {
- pub fn stay(self) -> Result<Stay, anyhow::Error> {
+impl<Current, Next> MoveResult<Current, Next> {
+ pub fn current(self) -> Result<Current, anyhow::Error> {
match self {
- MoveResult::Stay(o) => Ok(o),
- MoveResult::Go(_) => Err(anyhow::anyhow!("Not in stay state")),
+ MoveResult::Current(o) => Ok(o),
+ MoveResult::Next(_) => Err(anyhow::anyhow!("Not in current state")),
}
}
- pub fn go(self) -> Result<Go, anyhow::Error> {
+ pub fn next(self) -> Result<Next, anyhow::Error> {
match self {
- MoveResult::Go(f) => Ok(f),
- MoveResult::Stay(_) => Err(anyhow::anyhow!("Not in go state")),
+ MoveResult::Next(f) => Ok(f),
+ MoveResult::Current(_) => Err(anyhow::anyhow!("Not in next state")),
}
}
}