pub struct DataTypes<'types> {
pub meta: MetaData<'types>,
pub items: IndexMap<Ident, DataType<'types>>,
}
Expand description
Holds all generated Rust data types along with associated metadata.
This structure is produced by the Generator
after processing
the intermediate MetaTypes
. It serves as the
final intermediate representation used in the rendering stage to output Rust code.
The items
map contains type-safe, idiomatic Rust representations for each schema
element, type, or attribute group encountered.
The meta
field holds generator-specific configuration and state, such as flags,
postfix rules, and user-defined overrides, which influence the structure and naming
of generated code.
Fields§
§meta: MetaData<'types>
Meta types and information from the generator process
items: IndexMap<Ident, DataType<'types>>
Map of the different types.
Methods from Deref<Target = GeneratorMetaData<'types>>§
Sourcepub fn check_generator_flags(&self, flags: GeneratorFlags) -> bool
pub fn check_generator_flags(&self, flags: GeneratorFlags) -> bool
Whether the passed flags
intersect with the generator flags set in
the configuration, or not.
Methods from Deref<Target = MetaTypes>§
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)
.