From 85824b87ff927a0befd7d035ffbf414ced052fcc Mon Sep 17 00:00:00 2001 From: Kate Korsaro Date: Sun, 16 Nov 2025 08:00:52 +0100 Subject: [PATCH] feat: add an empty error enum --- 01.workspace/oxidice_lib/src/lib.rs | 2 + 01.workspace/oxidice_lib/src/str/failed_to.rs | 50 +++++++++++++++++++ 01.workspace/oxidice_lib/src/str/mod.rs | 1 + 3 files changed, 53 insertions(+) create mode 100644 01.workspace/oxidice_lib/src/str/failed_to.rs diff --git a/01.workspace/oxidice_lib/src/lib.rs b/01.workspace/oxidice_lib/src/lib.rs index 8784c5e..6891d24 100644 --- a/01.workspace/oxidice_lib/src/lib.rs +++ b/01.workspace/oxidice_lib/src/lib.rs @@ -6,3 +6,5 @@ mod mcr; mod str; mod trt; mod tst; + +pub(crate) use crate::str::failed_to::E as FailedTo; diff --git a/01.workspace/oxidice_lib/src/str/failed_to.rs b/01.workspace/oxidice_lib/src/str/failed_to.rs new file mode 100644 index 0000000..076b72b --- /dev/null +++ b/01.workspace/oxidice_lib/src/str/failed_to.rs @@ -0,0 +1,50 @@ +use crate::*; +// use std::fmt::Display; +// use std::str::FromStr; + +#[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)] +pub enum E { +} + +// 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; +// fn from_str(value: &str) -> std::result::Result> { +// 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"), +// } +// } +// } +// } diff --git a/01.workspace/oxidice_lib/src/str/mod.rs b/01.workspace/oxidice_lib/src/str/mod.rs index e69de29..614f1db 100644 --- a/01.workspace/oxidice_lib/src/str/mod.rs +++ b/01.workspace/oxidice_lib/src/str/mod.rs @@ -0,0 +1 @@ +pub mod failed_to;