Trait wasm_encoder::reencode::Reencode

source ·
pub trait Reencode {
    type Error;

Show 66 methods // Provided methods fn data_index(&mut self, data: u32) -> u32 { ... } fn element_index(&mut self, element: u32) -> u32 { ... } fn function_index(&mut self, func: u32) -> u32 { ... } fn global_index(&mut self, global: u32) -> u32 { ... } fn memory_index(&mut self, memory: u32) -> u32 { ... } fn table_index(&mut self, table: u32) -> u32 { ... } fn tag_index(&mut self, tag: u32) -> u32 { ... } fn type_index(&mut self, ty: u32) -> u32 { ... } fn component_type_index(&mut self, ty: u32) -> u32 { ... } fn abstract_heap_type( &mut self, value: AbstractHeapType, ) -> AbstractHeapType { ... } fn array_type( &mut self, array_ty: ArrayType, ) -> Result<ArrayType, Error<Self::Error>> { ... } fn block_type( &mut self, arg: BlockType, ) -> Result<BlockType, Error<Self::Error>> { ... } fn component_primitive_val_type( &mut self, ty: PrimitiveValType, ) -> PrimitiveValType { ... } fn component_export_kind( &mut self, ty: ComponentExternalKind, ) -> ComponentExportKind { ... } fn component_outer_alias_kind( &mut self, kind: ComponentOuterAliasKind, ) -> ComponentOuterAliasKind { ... } fn component_val_type(&mut self, ty: ComponentValType) -> ComponentValType { ... } fn type_bounds(&mut self, ty: TypeBounds) -> TypeBounds { ... } fn canonical_option(&mut self, ty: CanonicalOption) -> CanonicalOption { ... } fn component_type_ref(&mut self, ty: ComponentTypeRef) -> ComponentTypeRef { ... } fn const_expr( &mut self, const_expr: ConstExpr<'_>, ) -> Result<ConstExpr, Error<Self::Error>> { ... } fn catch(&mut self, arg: Catch) -> Catch { ... } fn composite_type( &mut self, composite_ty: CompositeType, ) -> Result<CompositeType, Error<Self::Error>> { ... } fn entity_type( &mut self, type_ref: TypeRef, ) -> Result<EntityType, Error<Self::Error>> { ... } fn export_kind(&mut self, external_kind: ExternalKind) -> ExportKind { ... } fn field_type( &mut self, field_ty: FieldType, ) -> Result<FieldType, Error<Self::Error>> { ... } fn func_type( &mut self, func_ty: FuncType, ) -> Result<FuncType, Error<Self::Error>> { ... } fn global_type( &mut self, global_ty: GlobalType, ) -> Result<GlobalType, Error<Self::Error>> { ... } fn heap_type( &mut self, heap_type: HeapType, ) -> Result<HeapType, Error<Self::Error>> { ... } fn instruction<'a>( &mut self, arg: Operator<'a>, ) -> Result<Instruction<'a>, Error<Self::Error>> { ... } fn memory_type(&mut self, memory_ty: MemoryType) -> MemoryType { ... } fn mem_arg(&mut self, arg: MemArg) -> MemArg { ... } fn ordering(&mut self, arg: Ordering) -> Ordering { ... } fn ref_type( &mut self, ref_type: RefType, ) -> Result<RefType, Error<Self::Error>> { ... } fn storage_type( &mut self, storage_ty: StorageType, ) -> Result<StorageType, Error<Self::Error>> { ... } fn struct_type( &mut self, struct_ty: StructType, ) -> Result<StructType, Error<Self::Error>> { ... } fn sub_type( &mut self, sub_ty: SubType, ) -> Result<SubType, Error<Self::Error>> { ... } fn table_type( &mut self, table_ty: TableType, ) -> Result<TableType, Error<Self::Error>> { ... } fn tag_kind(&mut self, kind: TagKind) -> TagKind { ... } fn tag_type(&mut self, tag_ty: TagType) -> TagType { ... } fn val_type( &mut self, val_ty: ValType, ) -> Result<ValType, Error<Self::Error>> { ... } fn parse_custom_section( &mut self, module: &mut Module, section: CustomSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn custom_section<'a>( &mut self, section: CustomSectionReader<'a>, ) -> CustomSection<'a> { ... } fn parse_code_section( &mut self, code: &mut CodeSection, section: CodeSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_function_body( &mut self, code: &mut CodeSection, func: FunctionBody<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn new_function_with_parsed_locals( &mut self, func: &FunctionBody<'_>, ) -> Result<Function, Error<Self::Error>> { ... } fn parse_instruction( &mut self, function: &mut Function, reader: &mut OperatorsReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_data_section( &mut self, data: &mut DataSection, section: DataSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_data( &mut self, data: &mut DataSection, datum: Data<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_element_section( &mut self, elements: &mut ElementSection, section: ElementSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_element( &mut self, elements: &mut ElementSection, element: Element<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_export_section( &mut self, exports: &mut ExportSection, section: ExportSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_export(&mut self, exports: &mut ExportSection, export: Export<'_>) { ... } fn parse_function_section( &mut self, functions: &mut FunctionSection, section: FunctionSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_global_section( &mut self, globals: &mut GlobalSection, section: GlobalSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_global( &mut self, globals: &mut GlobalSection, global: Global<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_import_section( &mut self, imports: &mut ImportSection, section: ImportSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_import( &mut self, imports: &mut ImportSection, import: Import<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_memory_section( &mut self, memories: &mut MemorySection, section: MemorySectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_table_section( &mut self, tables: &mut TableSection, section: TableSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_table( &mut self, tables: &mut TableSection, table: Table<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_tag_section( &mut self, tags: &mut TagSection, section: TagSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_type_section( &mut self, types: &mut TypeSection, section: TypeSectionReader<'_>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_recursive_type_group( &mut self, types: &mut TypeSection, rec_group: RecGroup, ) -> Result<(), Error<Self::Error>> { ... } fn parse_unknown_section( &mut self, module: &mut Module, id: u8, contents: &[u8], ) -> Result<(), Error<Self::Error>> { ... } fn intersperse_section_hook( &mut self, module: &mut Module, after: Option<SectionId>, before: Option<SectionId>, ) -> Result<(), Error<Self::Error>> { ... } fn parse_core_module( &mut self, module: &mut Module, parser: Parser, data: &[u8], ) -> Result<(), Error<Self::Error>> { ... }
}
Available on crate feature wasmparser only.

Required Associated Types§

Provided Methods§

source

fn data_index(&mut self, data: u32) -> u32

source

fn element_index(&mut self, element: u32) -> u32

source

fn function_index(&mut self, func: u32) -> u32

source

fn global_index(&mut self, global: u32) -> u32

source

fn memory_index(&mut self, memory: u32) -> u32

source

fn table_index(&mut self, table: u32) -> u32

source

fn tag_index(&mut self, tag: u32) -> u32

source

fn type_index(&mut self, ty: u32) -> u32

source

fn component_type_index(&mut self, ty: u32) -> u32

source

fn abstract_heap_type(&mut self, value: AbstractHeapType) -> AbstractHeapType

source

fn array_type( &mut self, array_ty: ArrayType, ) -> Result<ArrayType, Error<Self::Error>>

source

fn block_type( &mut self, arg: BlockType, ) -> Result<BlockType, Error<Self::Error>>

source

fn component_primitive_val_type( &mut self, ty: PrimitiveValType, ) -> PrimitiveValType

source

fn component_export_kind( &mut self, ty: ComponentExternalKind, ) -> ComponentExportKind

source

fn component_outer_alias_kind( &mut self, kind: ComponentOuterAliasKind, ) -> ComponentOuterAliasKind

source

fn component_val_type(&mut self, ty: ComponentValType) -> ComponentValType

source

fn type_bounds(&mut self, ty: TypeBounds) -> TypeBounds

source

fn canonical_option(&mut self, ty: CanonicalOption) -> CanonicalOption

source

fn component_type_ref(&mut self, ty: ComponentTypeRef) -> ComponentTypeRef

source

fn const_expr( &mut self, const_expr: ConstExpr<'_>, ) -> Result<ConstExpr, Error<Self::Error>>

source

fn catch(&mut self, arg: Catch) -> Catch

source

fn composite_type( &mut self, composite_ty: CompositeType, ) -> Result<CompositeType, Error<Self::Error>>

source

fn entity_type( &mut self, type_ref: TypeRef, ) -> Result<EntityType, Error<Self::Error>>

source

fn export_kind(&mut self, external_kind: ExternalKind) -> ExportKind

source

fn field_type( &mut self, field_ty: FieldType, ) -> Result<FieldType, Error<Self::Error>>

source

fn func_type( &mut self, func_ty: FuncType, ) -> Result<FuncType, Error<Self::Error>>

source

fn global_type( &mut self, global_ty: GlobalType, ) -> Result<GlobalType, Error<Self::Error>>

source

fn heap_type( &mut self, heap_type: HeapType, ) -> Result<HeapType, Error<Self::Error>>

source

fn instruction<'a>( &mut self, arg: Operator<'a>, ) -> Result<Instruction<'a>, Error<Self::Error>>

source

fn memory_type(&mut self, memory_ty: MemoryType) -> MemoryType

source

fn mem_arg(&mut self, arg: MemArg) -> MemArg

source

fn ordering(&mut self, arg: Ordering) -> Ordering

source

fn ref_type(&mut self, ref_type: RefType) -> Result<RefType, Error<Self::Error>>

source

fn storage_type( &mut self, storage_ty: StorageType, ) -> Result<StorageType, Error<Self::Error>>

source

fn struct_type( &mut self, struct_ty: StructType, ) -> Result<StructType, Error<Self::Error>>

source

fn sub_type(&mut self, sub_ty: SubType) -> Result<SubType, Error<Self::Error>>

source

fn table_type( &mut self, table_ty: TableType, ) -> Result<TableType, Error<Self::Error>>

source

fn tag_kind(&mut self, kind: TagKind) -> TagKind

source

fn tag_type(&mut self, tag_ty: TagType) -> TagType

source

fn val_type(&mut self, val_ty: ValType) -> Result<ValType, Error<Self::Error>>

source

fn parse_custom_section( &mut self, module: &mut Module, section: CustomSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds the custom section to the module.

source

fn custom_section<'a>( &mut self, section: CustomSectionReader<'a>, ) -> CustomSection<'a>

Converts the input section given from the wasmparser crate into an encoded custom section.

source

fn parse_code_section( &mut self, code: &mut CodeSection, section: CodeSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the code to the code section.

source

fn parse_function_body( &mut self, code: &mut CodeSection, func: FunctionBody<'_>, ) -> Result<(), Error<Self::Error>>

Parses a single wasmparser::FunctionBody and adds it to the code section.

source

fn new_function_with_parsed_locals( &mut self, func: &FunctionBody<'_>, ) -> Result<Function, Error<Self::Error>>

Create a new crate::Function by parsing the locals declarations from the provided wasmparser::FunctionBody.

source

fn parse_instruction( &mut self, function: &mut Function, reader: &mut OperatorsReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses a single instruction from reader and adds it to function.

source

fn parse_data_section( &mut self, data: &mut DataSection, section: DataSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the data to the data section.

source

fn parse_data( &mut self, data: &mut DataSection, datum: Data<'_>, ) -> Result<(), Error<Self::Error>>

Parses a single wasmparser::Data and adds it to the data section.

source

fn parse_element_section( &mut self, elements: &mut ElementSection, section: ElementSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the elements to the element section.

source

fn parse_element( &mut self, elements: &mut ElementSection, element: Element<'_>, ) -> Result<(), Error<Self::Error>>

Parses the single wasmparser::Element provided and adds it to the element section.

source

fn parse_export_section( &mut self, exports: &mut ExportSection, section: ExportSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the exports to the exports section.

source

fn parse_export(&mut self, exports: &mut ExportSection, export: Export<'_>)

Parses the single wasmparser::Export provided and adds it to the exports section.

source

fn parse_function_section( &mut self, functions: &mut FunctionSection, section: FunctionSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the functions to the functions section.

source

fn parse_global_section( &mut self, globals: &mut GlobalSection, section: GlobalSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the globals to the globals section.

source

fn parse_global( &mut self, globals: &mut GlobalSection, global: Global<'_>, ) -> Result<(), Error<Self::Error>>

Parses the single wasmparser::Global provided and adds it to the globals section.

source

fn parse_import_section( &mut self, imports: &mut ImportSection, section: ImportSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the imports to the import section.

source

fn parse_import( &mut self, imports: &mut ImportSection, import: Import<'_>, ) -> Result<(), Error<Self::Error>>

Parses the single wasmparser::Import provided and adds it to the import section.

source

fn parse_memory_section( &mut self, memories: &mut MemorySection, section: MemorySectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the memories to the memories section.

source

fn parse_table_section( &mut self, tables: &mut TableSection, section: TableSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the tables to the tables section.

source

fn parse_table( &mut self, tables: &mut TableSection, table: Table<'_>, ) -> Result<(), Error<Self::Error>>

Parses a single wasmparser::Table and adds it to the tables section.

source

fn parse_tag_section( &mut self, tags: &mut TagSection, section: TagSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the tags to the tags section.

source

fn parse_type_section( &mut self, types: &mut TypeSection, section: TypeSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

Parses the input section given from the wasmparser crate and adds all the types to the types section.

source

fn parse_recursive_type_group( &mut self, types: &mut TypeSection, rec_group: RecGroup, ) -> Result<(), Error<Self::Error>>

Parses a single wasmparser::RecGroup and adds it to the types section.

source

fn parse_unknown_section( &mut self, module: &mut Module, id: u8, contents: &[u8], ) -> Result<(), Error<Self::Error>>

source

fn intersperse_section_hook( &mut self, module: &mut Module, after: Option<SectionId>, before: Option<SectionId>, ) -> Result<(), Error<Self::Error>>

A hook method that is called inside Reencode::parse_core_module before and after every non-custom core wasm section.

This method can be used to insert new custom sections in between those sections, or to detect when a non-custom section is missing and insert it in the proper order.

The after parameter is None iff the hook is called before the first non-custom section, and Some(s) afterwards, where s is the SectionId of the previous non-custom section.

The before parameter is None iff the hook is called after the last non-custom section, and Some(s) beforehand, where s is the SectionId of the following non-custom section.

source

fn parse_core_module( &mut self, module: &mut Module, parser: Parser, data: &[u8], ) -> Result<(), Error<Self::Error>>

Implementors§