Struct mun_abi::TypeDefinition
source · #[repr(C)]pub struct TypeDefinition<'a> {
pub name: *const c_char,
pub data: TypeDefinitionData<'a>,
/* private fields */
}
Expand description
Represents the type declaration for a type that is exported by an assembly.
When multiple Mun modules reference the same type, only one module exports the type; the module
that contains the type definition. All the other Mun modules reference the type through a
TypeId
.
The modules that defines the type exports the data to reduce the filesize of the assemblies and to ensure only one definition exists. When linking all assemblies together the type definitions from all assemblies are loaded and the information is shared to modules that reference the type.
TODO: add support for polymorphism, enumerations, type parameters, generic type definitions, and constructed generic types.
Fields§
§name: *const c_char
Type name
data: TypeDefinitionData<'a>
Type group
Implementations§
source§impl<'a> TypeDefinition<'a>
impl<'a> TypeDefinition<'a>
sourcepub fn is_instance_of(&self, type_id: &TypeId<'a>) -> bool
pub fn is_instance_of(&self, type_id: &TypeId<'a>) -> bool
Returns true if this instance is an instance of the given TypeId
.
sourcepub fn as_concrete(&self) -> &Guid
pub fn as_concrete(&self) -> &Guid
Returns the GUID if this type represents a concrete type.
sourcepub fn as_struct(&self) -> Option<&StructDefinition<'_>>
pub fn as_struct(&self) -> Option<&StructDefinition<'_>>
Retrieves the type’s struct information, if available.
sourcepub fn size_in_bits(&self) -> usize
pub fn size_in_bits(&self) -> usize
Returns the size of the type in bits
sourcepub fn size_in_bytes(&self) -> usize
pub fn size_in_bytes(&self) -> usize
Returns the size of the type in bytes