blob: 8ab58d30358aef0b59e9f24ec1db281e301514f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use crate::knowledge::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Item {
Apple,
BallroomKey,
Lumi,
}
impl From<Item> for Noun { fn from(x: Item) -> Self {Noun::Item(x)} }
impl TryFrom<Noun> for Item {
type Error = ();
fn try_from(v: Noun) -> Result<Self, Self::Error> {
if let Noun::Item(x) = v { Ok(x) } else { Err(()) }
}
}
impl DisplayNoun for Item {
fn display_noun(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
|