use crate::{
generics::impl_generic_info_methods, ty::impl_type_methods, Generics, Reflect, Type, TypePath,
};
#[derive(Debug, Clone)]
pub struct OpaqueInfo {
ty: Type,
generics: Generics,
#[cfg(feature = "reflect_documentation")]
docs: Option<&'static str>,
}
impl OpaqueInfo {
pub fn new<T: Reflect + TypePath + ?Sized>() -> Self {
Self {
ty: Type::of::<T>(),
generics: Generics::new(),
#[cfg(feature = "reflect_documentation")]
docs: None,
}
}
#[cfg(feature = "reflect_documentation")]
pub fn with_docs(self, doc: Option<&'static str>) -> Self {
Self { docs: doc, ..self }
}
impl_type_methods!(ty);
#[cfg(feature = "reflect_documentation")]
pub fn docs(&self) -> Option<&'static str> {
self.docs
}
impl_generic_info_methods!(generics);
}