Skip to content
Discussion options

You must be logged in to vote

Actually, we implement wasm_encoder::Encode for wasm_encoder::Instruction so I think it would be slightly easier (compared to your OP) to do something like

use wasm_encoder::{Encode, reencode::Reencode};

let op: wasmparser::Operator = todo!();
let inst: wasm_encoder::Instruction = wasm_encoder::RoundtripReencoder.instruction(op)?;

let mut buf = vec![];
inst.encode(&mut buf);

Ok(buf.len())

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@fitzgen
Comment options

Answer selected by thesuhas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants