use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MiraType {
Nil,
Boolean,
Number,
String,
Array,
Record,
Function,
Module,
Extern,
}
impl MiraType {
#[inline]
pub const fn name(self) -> &'static str {
match self {
Self::Nil => "nil",
Self::Boolean => "boolean",
Self::Number => "number",
Self::String => "string",
Self::Array => "array",
Self::Record => "record",
Self::Function => "function",
Self::Module => "module",
Self::Extern => "extern",
}
}
}
impl fmt::Display for MiraType {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.name())
}
}