wasmtime_environ

Struct ModuleTypes

Source
pub struct ModuleTypes { /* private fields */ }
Expand description

All types used in a core wasm module.

Note that accessing this type is primarily done through the Index implementations for this type.

Implementations§

Source§

impl ModuleTypes

Source

pub fn wasm_types( &self, ) -> impl ExactSizeIterator<Item = (ModuleInternedTypeIndex, &WasmSubType)>

Returns an iterator over all the wasm function signatures found within this module.

Source

pub fn get(&self, ty: ModuleInternedTypeIndex) -> Option<&WasmSubType>

Get the type at the specified index, if it exists.

Source

pub fn rec_groups( &self, ) -> impl ExactSizeIterator<Item = (ModuleInternedRecGroupIndex, Range<ModuleInternedTypeIndex>)> + '_

Get an iterator over all recursion groups defined in this module and their elements.

Source

pub fn rec_group_elements( &self, rec_group: ModuleInternedRecGroupIndex, ) -> impl ExactSizeIterator<Item = ModuleInternedTypeIndex>

Get the elements within an already-defined rec group.

Source

pub fn len_types(&self) -> usize

Returns the number of types interned.

Source

pub fn push(&mut self, ty: WasmSubType) -> ModuleInternedTypeIndex

Adds a new type to this interned list of types.

Source

pub fn trampoline_types( &self, ) -> impl Iterator<Item = (ModuleInternedTypeIndex, ModuleInternedTypeIndex)> + '_

Iterate over the trampoline function types that this module requires.

Yields pairs of (1) a function type and (2) its associated trampoline type. They might be the same.

See the docs for WasmFuncType::trampoline_type for details on trampoline types.

Source

pub fn trampoline_type( &self, ty: ModuleInternedTypeIndex, ) -> ModuleInternedTypeIndex

Get the trampoline type for the given function type.

See the docs for WasmFuncType::trampoline_type for details on trampoline types.

Source§

impl ModuleTypes

Methods that only exist for ModuleTypesBuilder.

Source

pub fn set_trampoline_type( &mut self, for_ty: ModuleInternedTypeIndex, trampoline_ty: ModuleInternedTypeIndex, )

Associate trampoline_ty as the trampoline type for for_ty.

Source

pub fn push_rec_group( &mut self, range: Range<ModuleInternedTypeIndex>, ) -> ModuleInternedRecGroupIndex

Adds a new rec group to this interned list of types.

Source

pub fn reserve(&mut self, amt: usize)

Reserves space for amt more types.

Source

pub fn next_rec_group(&self) -> ModuleInternedRecGroupIndex

Returns the next return value of push_rec_group.

Source

pub fn next_ty(&self) -> ModuleInternedTypeIndex

Returns the next return value of push.

Trait Implementations§

Source§

impl Default for ModuleTypes

Source§

fn default() -> ModuleTypes

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ModuleTypes

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Index<ModuleInternedTypeIndex> for ModuleTypes

Source§

type Output = WasmSubType

The returned type after indexing.
Source§

fn index(&self, sig: ModuleInternedTypeIndex) -> &WasmSubType

Performs the indexing (container[index]) operation. Read more
Source§

impl Serialize for ModuleTypes

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,