Struct mun_memory::Type

source ·
pub struct Type { /* private fields */ }
Expand description

A reference to internally stored type information. A Type can be used to query information, construct other types, or store type information for later use.

Implementations§

Collects all data related to types that are no longer referenced by a Type. Returns the number of types that were removed.

Constructs a new struct type

Returns the name of the type

Returns the memory layout of the data of the type. This is the layout of the memory when stored on the stack or in the heap.

Returns the layout of the type when being referenced.

Returns true if the type is a reference type. Variables of reference types store references to their data (objects), while variables of value types directly contain their data.

Returns true if the type is a value type. Variables of reference types store references to their data (objects), while variables of value types directly contain their data.

Returns true if this instance represents the TypeInfo of the given type.

assert!(i64::type_info().equals::<i64>());
assert!(!i64::type_info().equals::<f64>())

Returns whether this is a fundamental type.

Returns whether this is a struct type.

Returns whether this is a pointer type.

Returns whether this is an array type.

Returns the kind of the type

Returns true if this type is a concrete type. This is the case for any type that doesn’t refer to another type like a pointer.

Returns the GUID associated with this instance if this instance represents a concrete type.

Retrieves the type’s struct information, if available.

Retrieves the type’s pointer information, if available.

Retrieves the type’s array information, if available.

Tries to convert multiple abi::TypeDefinition to internal type representations. If the conversion succeeds an updated TypeTable is returned

Returns the type that represents a pointer to this type

Returns the type that represents an array to this type

Consumes the Type, returning a wrapped raw pointer.

After calling this function, the caller is responsible for the memory previously managed by the Type. The easiest way to do this is to convert the raw pointer back into a Type with the Type::from_raw function, allowing the Type destructor to perform the cleanup.

Constructs a box from a raw pointer.

After calling this function, the raw pointer is owned by the resulting Type. Specifically, the Type destructor will ensure the memory previously retained by the raw will be properly cleaned up. For this to be safe, the passed in raw pointer must have been previously returned by Type::into_raw.

This function must also not be called as part of static deinitialization as that may cause undefined behavior in the underlying implementation. Therefor passing the raw pointer over FFI might not be safe. Instead, wrap the Type in an Arc or a Box and use that on the FFI boundary.

Safety

This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Returns an iterator to iterate over all GC objects that are referenced by the given object.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.