pub struct MetaTypes {
pub items: BTreeMap<Ident, MetaType>,
pub modules: BTreeMap<NamespaceId, ModuleMeta>,
pub schemas: BTreeMap<SchemaId, SchemaMeta>,
/* private fields */
}
Expand description
Intermediate representation of all resolved type and module metadata.
This structure is created by the Interpreter
from the parsed Schemas
. It contains the full set of
interpreted types, along with module-to-namespace mappings.
This type acts as the canonical source of truth for all derived type definitions,
which can be passed to the Optimizer
for post-processing,
or used directly by the code Generator
.
Fields§
§items: BTreeMap<Ident, MetaType>
Map of the different types.
modules: BTreeMap<NamespaceId, ModuleMeta>
Map of the different namespaces.
schemas: BTreeMap<SchemaId, SchemaMeta>
Map of the different schemas.
Implementations§
Source§impl MetaTypes
impl MetaTypes
Sourcepub fn name_builder(&mut self) -> NameBuilder
pub fn name_builder(&mut self) -> NameBuilder
Create a new NameBuilder
instance, that can be used to build type named.
Sourcepub fn get_resolved<'a>(
&'a self,
ident: &'a Ident,
) -> Option<(&'a Ident, &'a MetaType)>
pub fn get_resolved<'a>( &'a self, ident: &'a Ident, ) -> Option<(&'a Ident, &'a MetaType)>
Get the identifier and the type of the passed ident
with all single
type references resolved.
Tries to find the type specified by the passed ident
and resolve simple
type definitions to the very base type. If the type could not be found None
is returned.
Sourcepub fn get_resolved_type<'a>(&'a self, ident: &'a Ident) -> Option<&'a MetaType>
pub fn get_resolved_type<'a>(&'a self, ident: &'a Ident) -> Option<&'a MetaType>
Get the type of the passed ident
with all single type references resolved.
Like get_resolved
, but instead of returning the identifier and
the type it will return only the resolved type.
Sourcepub fn get_resolved_ident<'a>(&'a self, ident: &'a Ident) -> Option<&'a Ident>
pub fn get_resolved_ident<'a>(&'a self, ident: &'a Ident) -> Option<&'a Ident>
Get the type ident of the passed ident
with all single type references resolved.
Like get_resolved
, but instead of returning the identifier and
the type it will return only the identifier of the resolved type.
Sourcepub fn get_variant(&self, ident: &Ident) -> Option<&MetaTypeVariant>
pub fn get_variant(&self, ident: &Ident) -> Option<&MetaTypeVariant>
Return the MetaTypeVariant
of corresponding type for the passed identifier.
This is a shorthand for self.get(ident).map(|ty| &type.variant)
.
Sourcepub fn get_variant_mut(&mut self, ident: &Ident) -> Option<&mut MetaTypeVariant>
pub fn get_variant_mut(&mut self, ident: &Ident) -> Option<&mut MetaTypeVariant>
Return the MetaTypeVariant
of corresponding type for the passed identifier.
This is a shorthand for self.get_mut(ident).map(|ty| &type.variant)
.