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
impl Debug for RoundtripReencoder
source§impl Reencode for RoundtripReencoder
impl Reencode for RoundtripReencoder
type Error = Infallible
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 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 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>>
source§fn parse_custom_section(
&mut self,
module: &mut Module,
section: CustomSectionReader<'_>,
) -> Result<(), Error<Self::Error>>
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>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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<'_>)
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
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.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>>
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 morefn parse_core_module( &mut self, module: &mut Module, parser: Parser, data: &[u8], ) -> Result<(), Error<Self::Error>>
Auto Trait Implementations§
impl Freeze for RoundtripReencoder
impl RefUnwindSafe for RoundtripReencoder
impl Send for RoundtripReencoder
impl Sync for RoundtripReencoder
impl Unpin for RoundtripReencoder
impl UnwindSafe for RoundtripReencoder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more