diff options
| author | LLLL Colonq <llll@colonq> | 2026-10-12 01:31:00 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-10-12 01:31:00 -0400 |
| commit | c4ee47647a5bf1a06ae88ebb9410117c927868ee (patch) | |
| tree | 0700a10322e649db6df9f110058a09af1e3ef26f /crates/elfmind/src/noun | |
| parent | 742fcf6793e1a38d4cf65bf72832847c0fd679b4 (diff) | |
Major refactor, generate relation traits with macros
Diffstat (limited to 'crates/elfmind/src/noun')
| -rw-r--r-- | crates/elfmind/src/noun/character.rs | 41 | ||||
| -rw-r--r-- | crates/elfmind/src/noun/item.rs | 20 | ||||
| -rw-r--r-- | crates/elfmind/src/noun/time.rs | 16 |
3 files changed, 77 insertions, 0 deletions
diff --git a/crates/elfmind/src/noun/character.rs b/crates/elfmind/src/noun/character.rs new file mode 100644 index 0000000..e6029c0 --- /dev/null +++ b/crates/elfmind/src/noun/character.rs @@ -0,0 +1,41 @@ +use crate::knowledge::*; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum CharacterUnmasked { + Assagioli, + Bombieri, + Cagliostro, + Divini, + Eustachi, + Fracastoro, + Grimaldi, + Human, +} +impl From<CharacterUnmasked> for Noun { fn from(x: CharacterUnmasked) -> Self {Noun::CharacterUnmasked(x)} } +impl TryFrom<Noun> for CharacterUnmasked { + type Error = (); + fn try_from(v: Noun) -> Result<Self, Self::Error> { + if let Noun::CharacterUnmasked(x) = v { Ok(x) } else { Err(()) } + } +} +impl DisplayNoun for CharacterUnmasked { + fn display_noun(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum CharacterMasked { + Dragon, + Tiger, + Rooster, + Rabbit, + Dog, + Horse, + Monkey, + Ox, + Goat, + Snake, + Rat, + Pig, +} diff --git a/crates/elfmind/src/noun/item.rs b/crates/elfmind/src/noun/item.rs new file mode 100644 index 0000000..8ab58d3 --- /dev/null +++ b/crates/elfmind/src/noun/item.rs @@ -0,0 +1,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) + } +} diff --git a/crates/elfmind/src/noun/time.rs b/crates/elfmind/src/noun/time.rs new file mode 100644 index 0000000..1a69da5 --- /dev/null +++ b/crates/elfmind/src/noun/time.rs @@ -0,0 +1,16 @@ +use crate::knowledge::*; + +pub type Time = u64; + +impl From<Time> for Noun { fn from(x: Time) -> Self {Noun::Time(x)} } +impl TryFrom<Noun> for Time { + type Error = (); + fn try_from(v: Noun) -> Result<Self, Self::Error> { + if let Noun::Time(x) = v { Ok(x) } else { Err(()) } + } +} +impl DisplayNoun for Time { + fn display_noun(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} |
