diff --git a/frontend/src/pages/game.rs b/frontend/src/pages/game.rs index aa1a672..e39c7a6 100644 --- a/frontend/src/pages/game.rs +++ b/frontend/src/pages/game.rs @@ -1,29 +1,30 @@ -use serde::{Deserialize, Serialize}; - -use crate::CharStatus; - -#[derive(Debug,Serialize, Deserialize, Clone)] -struct Game { - word: String, - submitted_words: Vec>>, - result: GameResult, -} - -impl Game { - pub fn new(word: String, submitted_words: Vec>>) -> Self { - let result = submitted_words.clone().into_iter().last().map_or(GameResult::Lose, |w| if w.iter().all(|v| matches!(v, CharStatus::Match(_))) { - GameResult::Win - } else { - GameResult::Lose - }); - - Self { word, submitted_words, result } - } -} - - -#[derive(Debug,Serialize, Deserialize, Clone, PartialEq, Eq)] -enum GameResult { - Win, - Lose, +use serde::{Deserialize, Serialize}; + +use crate::CharStatus; + +#[derive(Debug,Serialize, Deserialize, Clone)] +struct Game { + word: String, + submitted_words: Vec>>, + result: GameResult, +} + +impl Game { + #[allow(dead_code)] + pub fn new(word: String, submitted_words: Vec>>) -> Self { + let result = submitted_words.clone().into_iter().last().map_or(GameResult::Lose, |w| if w.iter().all(|v| matches!(v, CharStatus::Match(_))) { + GameResult::Win + } else { + GameResult::Lose + }); + + Self { word, submitted_words, result } + } +} + + +#[derive(Debug,Serialize, Deserialize, Clone, PartialEq, Eq)] +enum GameResult { + Win, + Lose, } \ No newline at end of file