use std::borrow::Cow;
use crate::{DataType, DeprecatedType, ImplLocation, SpectaID};
#[derive(Debug, Clone, PartialEq)]
pub struct NamedDataTypeExt {
pub(crate) sid: SpectaID,
pub(crate) impl_location: ImplLocation,
}
impl NamedDataTypeExt {
pub fn sid(&self) -> &SpectaID {
&self.sid
}
pub fn impl_location(&self) -> &ImplLocation {
&self.impl_location
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct NamedDataType {
pub(crate) name: Cow<'static, str>,
pub(crate) docs: Cow<'static, str>,
pub(crate) deprecated: Option<DeprecatedType>,
pub(crate) ext: Option<NamedDataTypeExt>,
pub inner: DataType,
}
impl NamedDataType {
pub fn name(&self) -> &Cow<'static, str> {
&self.name
}
pub fn docs(&self) -> &Cow<'static, str> {
&self.docs
}
pub fn deprecated(&self) -> Option<&DeprecatedType> {
self.deprecated.as_ref()
}
pub fn ext(&self) -> Option<&NamedDataTypeExt> {
self.ext.as_ref()
}
}