use std::fmt::Display; /// Values in the interpreter. /// /// Yes, this is yet another definition of a structure called `Value`, which /// are almost entirely identical. However, it's nice to have them separated /// by type so that we don't mix them up. #[derive(Clone, Debug, PartialEq)] pub enum Value { I64(i64), } impl Display for Value { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Value::I64(x) => write!(f, "{}i64", x), } } } impl From for Value { fn from(value: i64) -> Self { Value::I64(value) } }