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

§

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 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. Read more
source§

fn parse_core_module( &mut self, module: &mut Module, parser: Parser, data: &[u8], ) -> 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>,

§

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>,

§

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.