use crate::{RawStr, Rtti, StaticType, VariantRtti};
use std::fmt;
use std::sync::Arc;
#[derive(Debug, Clone)]
pub enum TypeInfo {
StaticType(&'static StaticType),
Any(RawStr),
Typed(Arc<Rtti>),
Variant(Arc<VariantRtti>),
}
impl fmt::Display for TypeInfo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::StaticType(ty) => {
write!(fmt, "{}", ty.name)?;
}
Self::Any(type_name) => {
write!(fmt, "{}", *type_name)?;
}
Self::Typed(rtti) => {
write!(fmt, "{}", rtti.item)?;
}
Self::Variant(rtti) => {
write!(fmt, "{}", rtti.item)?;
}
}
Ok(())
}
}