-
Is there anyway one can determine the size of a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't believe we expose an easier way of doing it now than what you've sketched but I don't think there is any fundamental reason we couldn't do better |
Beta Was this translation helpful? Give feedback.
-
Actually, we implement 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()) |
Beta Was this translation helpful? Give feedback.
Actually, we implement
wasm_encoder::Encode
forwasm_encoder::Instruction
so I think it would be slightly easier (compared to your OP) to do something like