feat: add enum 'Outcome'
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
pub mod die;
|
pub mod die;
|
||||||
pub mod failed_to;
|
pub mod failed_to;
|
||||||
pub mod handful;
|
pub mod handful;
|
||||||
|
pub mod outcome;
|
||||||
|
|||||||
52
01.workspace/oxidice_lib/src/str/outcome.rs
Normal file
52
01.workspace/oxidice_lib/src/str/outcome.rs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
use crate::*;
|
||||||
|
// use std::fmt::Display;
|
||||||
|
// use std::str::FromStr;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Hash)]
|
||||||
|
pub enum E {
|
||||||
|
Scalar(u16),
|
||||||
|
List(Vec<u16>),
|
||||||
|
}
|
||||||
|
|
||||||
|
// impl Display for E {
|
||||||
|
// fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
|
||||||
|
// match self {
|
||||||
|
// Self::NoValue => write!(f, "NoValue"),
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// impl FromStr for E {
|
||||||
|
// type Err = Box<dyn std::error::Error>;
|
||||||
|
// fn from_str(value: &str) -> std::result::Result<Self, Box<dyn std::error::Error>> {
|
||||||
|
// match value {
|
||||||
|
// "NoValue" => Ok(Self::NoValue),
|
||||||
|
// _ => unreachable!(),
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// #[cfg(test)]
|
||||||
|
// mod unit_tests {
|
||||||
|
// use super::*;
|
||||||
|
// #[test]
|
||||||
|
// fn check_001() {
|
||||||
|
// for value in [E::NoValue] {
|
||||||
|
// match value {
|
||||||
|
// E::NoValue => assert_eq!(
|
||||||
|
// E::NoValue,
|
||||||
|
// E::from_str("NoValue").unwrap()
|
||||||
|
// ),
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// #[test]
|
||||||
|
// fn check_002() {
|
||||||
|
// for value in [E::NoValue] {
|
||||||
|
// match value {
|
||||||
|
// E::NoValue => assert_eq!(&E::NoValue.to_string(), "NoValue"),
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
Reference in New Issue
Block a user