diff options
Diffstat (limited to 'crates/elfmind/src/noun/time.rs')
| -rw-r--r-- | crates/elfmind/src/noun/time.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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) + } +} |
