1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::hash::Hash;
use crate::StaticType;
use std::fmt;
#[derive(Debug, Clone, Copy)]
pub enum TypeInfo {
StaticType(&'static StaticType),
Hash(Hash),
Any(&'static str),
}
impl fmt::Display for TypeInfo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Self::StaticType(ty) => {
write!(fmt, "{}", ty.name)?;
}
Self::Hash(ty) => {
write!(fmt, "Type({})", ty)?;
}
Self::Any(type_name) => {
write!(fmt, "{}", type_name)?;
}
}
Ok(())
}
}