TypeDefinition

Struct TypeDefinition 

Source
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>

Source

pub fn is_instance_of(&self, type_id: &TypeId<'a>) -> bool

Returns true if this instance is an instance of the given TypeId.

Source

pub fn name(&self) -> &str

Returns the type’s name.

Source

pub fn as_concrete(&self) -> &Guid

Returns the GUID if this type represents a concrete type.

Source

pub fn as_struct(&self) -> Option<&StructDefinition<'_>>

Retrieves the type’s struct information, if available.

Source

pub fn size_in_bits(&self) -> usize

Returns the size of the type in bits

Source

pub fn size_in_bytes(&self) -> usize

Returns the size of the type in bytes

Source

pub fn alignment(&self) -> usize

Returns the alignment of the type in bytes

Trait Implementations§

Source§

impl<'a> Debug for TypeDefinition<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Display for TypeDefinition<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for TypeDefinition<'a>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for TypeDefinition<'a>

Source§

impl<'a> Send for TypeDefinition<'a>

Source§

impl<'a> Sync for TypeDefinition<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for TypeDefinition<'a>

§

impl<'a> RefUnwindSafe for TypeDefinition<'a>

§

impl<'a> Unpin for TypeDefinition<'a>

§

impl<'a> UnwindSafe for TypeDefinition<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.