diff --git a/src/game/evaluation.rs b/src/game/evaluation.rs new file mode 100644 index 0000000..d99cb4d --- /dev/null +++ b/src/game/evaluation.rs @@ -0,0 +1,33 @@ +use std::convert::Infallible; +use std::str::FromStr; + +use super::response::Status; + +#[derive(Debug, Clone, PartialEq, Default)] +pub struct Evaluation { + inner: Vec, +} +pub type EvaluationUnit = (char, Status); + +impl IntoIterator for Evaluation { + type Item = EvaluationUnit; + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.inner.into_iter() + } +} + +impl From> for Evaluation { + fn from(value: Vec) -> Self { + Self { inner: value } + } +} + +impl FromStr for Evaluation { + type Err = Infallible; + fn from_str(s: &str) -> Result { + // TODO: make this proper + Ok(vec![('x', Status::None)].into()) + } +} diff --git a/src/game/mod.rs b/src/game/mod.rs index 8ce9996..a1f36d4 100644 --- a/src/game/mod.rs +++ b/src/game/mod.rs @@ -9,6 +9,9 @@ use libpt::log::{debug, trace}; pub mod response; use response::GuessResponse; +pub mod evaluation; +use evaluation::*; + pub mod summary; use self::response::{Evaluation, Status};