Struct wasm_encoder::reencode::RoundtripReencoder

source ·
pub struct RoundtripReencoder;
Available on crate feature wasmparser only.
Expand description

Reencodes wasmparser into wasm-encoder so that the encoded wasm is identical to the input and can be parsed and encoded again.

Trait Implementations§

source§

impl Debug for RoundtripReencoder

source§

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

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

impl Reencode for RoundtripReencoder

source§

type Error = Infallible

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 type_index_unpacked( &mut self, ty: UnpackedIndex, ) -> Result<u32, Error<Self::Error>>

source§

fn external_index(&mut self, kind: ExternalKind, index: 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 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<'a>( &mut self, reader: &mut OperatorsReader<'a>, ) -> Result<Instruction<'a>, 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. Read more
source§

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

source§

fn custom_name_section( &mut self, section: NameSectionReader<'_>, ) -> Result<NameSection, Error<Self::Error>>

source§

fn parse_custom_name_subsection( &mut self, names: &mut NameSection, section: Name<'_>, ) -> Result<(), Error<Self::Error>>

source§

impl ReencodeComponent for RoundtripReencoder

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn outer_component_index(&mut self, count: u32, component: u32) -> u32

source§

fn outer_module_index(&mut self, count: u32, module: u32) -> u32

source§

fn push_depth(&mut self)

source§

fn pop_depth(&mut self)

source§

fn component_external_index( &mut self, kind: ComponentExternalKind, index: u32, ) -> u32

source§

fn parse_component( &mut self, component: &mut Component, parser: Parser, data: &[u8], ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_payload( &mut self, component: &mut Component, payload: Payload<'_>, whole_component: &[u8], ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_submodule( &mut self, component: &mut Component, parser: Parser, module: &[u8], ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_subcomponent( &mut self, component: &mut Component, parser: Parser, subcomponent: &[u8], whole_component: &[u8], ) -> Result<(), Error<Self::Error>>

source§

fn parse_unknown_component_section( &mut self, component: &mut Component, id: u8, contents: &[u8], ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_custom_section( &mut self, component: &mut Component, section: CustomSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_type_section( &mut self, types: &mut ComponentTypeSection, section: ComponentTypeSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_type( &mut self, dst: ComponentTypeEncoder<'_>, ty: ComponentType<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn component_instance_type( &mut self, ty: Box<[InstanceTypeDeclaration<'_>]>, ) -> Result<InstanceType, Error<Self::Error>>

source§

fn parse_component_instance_type_declaration( &mut self, ty: &mut InstanceType, decl: InstanceTypeDeclaration<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_core_type( &mut self, ty: CoreTypeEncoder<'_>, core: CoreType<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn component_type( &mut self, ty: Box<[ComponentTypeDeclaration<'_>]>, ) -> Result<ComponentType, Error<Self::Error>>

source§

fn parse_component_type_declaration( &mut self, component: &mut ComponentType, decl: ComponentTypeDeclaration<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_func_type( &mut self, func: ComponentFuncTypeEncoder<'_>, ty: ComponentFuncType<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_defined_type( &mut self, defined: ComponentDefinedTypeEncoder<'_>, ty: ComponentDefinedType<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn component_module_type( &mut self, ty: Box<[ModuleTypeDeclaration<'_>]>, ) -> Result<ModuleType, Error<Self::Error>>

source§

fn parse_component_module_type_declaration( &mut self, module: &mut ModuleType, decl: ModuleTypeDeclaration<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn component_alias<'a>( &mut self, alias: ComponentAlias<'a>, ) -> Result<Alias<'a>, Error<Self::Error>>

source§

fn parse_component_sub_type( &mut self, ty: CoreTypeEncoder<'_>, sub: SubType, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_import_section( &mut self, imports: &mut ComponentImportSection, section: ComponentImportSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_canonical_section( &mut self, canonical: &mut CanonicalFunctionSection, section: ComponentCanonicalSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_canonical( &mut self, section: &mut CanonicalFunctionSection, func: CanonicalFunction, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_alias_section( &mut self, aliases: &mut ComponentAliasSection, section: ComponentAliasSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_instance_section( &mut self, instances: &mut ComponentInstanceSection, section: ComponentInstanceSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_instance( &mut self, instances: &mut ComponentInstanceSection, instance: ComponentInstance<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_instance_section( &mut self, instances: &mut InstanceSection, section: InstanceSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_instance( &mut self, instances: &mut InstanceSection, instance: Instance<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_core_type_section( &mut self, types: &mut CoreTypeSection, section: CoreTypeSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_export_section( &mut self, exports: &mut ComponentExportSection, section: ComponentExportSectionReader<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_export( &mut self, exports: &mut ComponentExportSection, export: ComponentExport<'_>, ) -> Result<(), Error<Self::Error>>

source§

fn parse_component_start_section( &mut self, component: &mut Component, func: ComponentStartFunction, ) -> Result<(), Error<Self::Error>>

source§

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

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 custom_component_name_section( &mut self, section: ComponentNameSectionReader<'_>, ) -> Result<ComponentNameSection, Error<Self::Error>>

source§

fn parse_custom_component_name_subsection( &mut self, names: &mut ComponentNameSection, section: ComponentName<'_>, ) -> Result<(), Error<Self::Error>>

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.