Converting certain component types from wasmparser
to wasm_encoder
#1639
-
Hi, I'm writing a WebAssembly Manipulation Library for the Component Model in Rust called Orca. I'm converting the
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You might be interested in #1628 which just landed. That's only got support for core modules but if you're interested in adding these conversions to wasm-encoder itself that'd be a welcome PR (and would "just" be extending the new For For component functions the This'd definitely make sense to bake straight into |
Beta Was this translation helpful? Give feedback.
-
Thanks! I'll get into adding this to the PR! I had a few more questions as well. I'm also trying to convert the On the |
Beta Was this translation helpful? Give feedback.
-
Additionally, I see that ComponentType has a I see that I'm wondering how to recursively convert this as there is a bit of recursion in functions in both |
Beta Was this translation helpful? Give feedback.
You might be interested in #1628 which just landed. That's only got support for core modules but if you're interested in adding these conversions to wasm-encoder itself that'd be a welcome PR (and would "just" be extending the new
Reencode
trait). As for your questions:For
wasmparser::HeapType
only theModule
variant can be converted. The other two variants should trigger a panic or an error. They're transient states during validation and afterwards but will never show up if you're only parsing a component.For component functions the
Unnamed
type would map to calling theresult
method, notresults
, so you'd basically call one or the other.This'd definitely make sense to bake straight i…