pub struct ModuleTypesBuilder { /* private fields */ }
Expand description
A builder for ModuleTypes
.
Implementations§
source§impl ModuleTypesBuilder
impl ModuleTypesBuilder
sourcepub fn new(validator: &Validator) -> Self
pub fn new(validator: &Validator) -> Self
Construct a new ModuleTypesBuilder
using the given validator.
sourcepub fn reserve_wasm_signatures(&mut self, amt: usize)
pub fn reserve_wasm_signatures(&mut self, amt: usize)
Reserves space for amt
more type signatures.
sourcepub fn validator_id(&self) -> ValidatorId
pub fn validator_id(&self) -> ValidatorId
Get the id of the validator that this builder is configured for.
sourcepub fn intern_rec_group(
&mut self,
module: &Module,
validator_types: TypesRef<'_>,
rec_group_id: RecGroupId,
) -> WasmResult<ModuleInternedRecGroupIndex>
pub fn intern_rec_group( &mut self, module: &Module, validator_types: TypesRef<'_>, rec_group_id: RecGroupId, ) -> WasmResult<ModuleInternedRecGroupIndex>
Intern a recursion group and all of its types into this builder.
If the recursion group has already been interned, then it is reused.
Panics if given types from a different validator than the one that this builder is associated with.
sourcepub fn intern_type(
&mut self,
module: &Module,
validator_types: TypesRef<'_>,
id: CoreTypeId,
) -> WasmResult<ModuleInternedTypeIndex>
pub fn intern_type( &mut self, module: &Module, validator_types: TypesRef<'_>, id: CoreTypeId, ) -> WasmResult<ModuleInternedTypeIndex>
Intern a type into this builder and get its Wasmtime index.
This will intern not only the single given type, but the type’s entire rec group. This helper method is provided as a convenience so that callers don’t have to get the type’s rec group, intern the rec group, and then look up the Wasmtime index for the original type themselves.
sourcepub fn finish(self) -> ModuleTypes
pub fn finish(self) -> ModuleTypes
Returns the result ModuleTypes
of this builder.
sourcepub fn rec_group_elements(
&self,
rec_group: ModuleInternedRecGroupIndex,
) -> impl ExactSizeIterator<Item = ModuleInternedTypeIndex>
pub fn rec_group_elements( &self, rec_group: ModuleInternedRecGroupIndex, ) -> impl ExactSizeIterator<Item = ModuleInternedTypeIndex>
Get the elements within an already-defined rec group.
sourcepub fn wasm_types(
&self,
) -> impl Iterator<Item = (ModuleInternedTypeIndex, &WasmSubType)>
pub fn wasm_types( &self, ) -> impl Iterator<Item = (ModuleInternedTypeIndex, &WasmSubType)>
Returns an iterator over all the unique wasm types defined thus far within this builder.
sourcepub fn trampoline_types(
&self,
) -> impl Iterator<Item = (ModuleInternedTypeIndex, ModuleInternedTypeIndex)> + '_
pub fn trampoline_types( &self, ) -> impl Iterator<Item = (ModuleInternedTypeIndex, ModuleInternedTypeIndex)> + '_
Get an iterator over all function types and their associated trampoline type.
sourcepub fn trampoline_type(
&self,
ty: ModuleInternedTypeIndex,
) -> ModuleInternedTypeIndex
pub fn trampoline_type( &self, ty: ModuleInternedTypeIndex, ) -> ModuleInternedTypeIndex
Get the associated trampoline type for the given function type.