generated from PlexSheep/rs-base
refactor(evaluation): move evaluation to a new module
cargo devel CI / cargo CI (push) Successful in 1m48s
Details
cargo devel CI / cargo CI (push) Successful in 1m48s
Details
This commit is contained in:
parent
8a48498182
commit
36347d1661
|
@ -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<EvaluationUnit>,
|
||||||
|
}
|
||||||
|
pub type EvaluationUnit = (char, Status);
|
||||||
|
|
||||||
|
impl IntoIterator for Evaluation {
|
||||||
|
type Item = EvaluationUnit;
|
||||||
|
type IntoIter = std::vec::IntoIter<Self::Item>;
|
||||||
|
|
||||||
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
|
self.inner.into_iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Vec<EvaluationUnit>> for Evaluation {
|
||||||
|
fn from(value: Vec<EvaluationUnit>) -> Self {
|
||||||
|
Self { inner: value }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for Evaluation {
|
||||||
|
type Err = Infallible;
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
// TODO: make this proper
|
||||||
|
Ok(vec![('x', Status::None)].into())
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,9 @@ use libpt::log::{debug, trace};
|
||||||
pub mod response;
|
pub mod response;
|
||||||
use response::GuessResponse;
|
use response::GuessResponse;
|
||||||
|
|
||||||
|
pub mod evaluation;
|
||||||
|
use evaluation::*;
|
||||||
|
|
||||||
pub mod summary;
|
pub mod summary;
|
||||||
|
|
||||||
use self::response::{Evaluation, Status};
|
use self::response::{Evaluation, Status};
|
||||||
|
|
Loading…
Reference in New Issue