Stream: git-wasmtime

Topic: wasmtime / issue #5788 Set `wasmtime::component::values` ...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 16:45):

Officeyutong opened issue #5788:

I'm trying to call an exported function with signature func (seq: list<s64>) -> s64, but I find that I can't construct wasmtime::component::Val::List(wasmtime::component::values::List()) since wasmtime::component::values::List is not public.

Feature

Add pub to https://github.com/bytecodealliance/wasmtime/blob/e10094dcd6d0354628255a6f2e69c1e4c327d6e7/crates/wasmtime/src/component/mod.rs#L16

Benefit

If accepted, We can invoke functions which contains a param with type list

Implementation

Just add a pub prefix

Alternatives

May be no alternatives available?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 17:45):

pchickey commented on issue #5788:

At the moment, you can construct a list Val by way of wasmtime::component::types::List::new_val https://docs.rs/wasmtime/latest/wasmtime/component/types/struct.List.html#method.new_val - does that meet your needs?

I think it would be ok to make the values mod public, just on the grounds that if the Val enum is public, the types in all of its variants should be as well (https://docs.rs/wasmtime/latest/wasmtime/component/enum.Val.html), but I don't know if there is something about the design of using the types module to construct Val vs the direct use of the enum that I am missing. @alexcrichton what do you think?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 17:45):

pchickey edited a comment on issue #5788:

At the moment, you can construct a list Val by way of wasmtime::component::types::List::new_val https://docs.rs/wasmtime/latest/wasmtime/component/types/struct.List.html#method.new_val - does that meet your needs?

I think it would be ok to make the values mod public, just on the grounds that if the Val enum is public, the types in all of its variants should be as well (https://docs.rs/wasmtime/latest/wasmtime/component/enum.Val.html), but I don't know if there is something about the design of using the types module to construct Val vs the direct use of the enum that I am missing. @alexcrichton what do you think?

If we choose not to make those types public we should note the preferred way to construct those variants in the docs for Val.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 18:05):

alexcrichton commented on issue #5788:

The original intention was to reexport everything necessary form the values module into the top-level component module, so this may be a forgotten reexport?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 15 2023 at 18:11):

pchickey commented on issue #5788:

Ok! I'll add the forgotten reexports :)

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2023 at 05:20):

pchickey closed issue #5788:

I'm trying to call an exported function with signature func (seq: list<s64>) -> s64, but I find that I can't construct wasmtime::component::Val::List(wasmtime::component::values::List()) since wasmtime::component::values::List is not public.

Feature

Add pub to https://github.com/bytecodealliance/wasmtime/blob/e10094dcd6d0354628255a6f2e69c1e4c327d6e7/crates/wasmtime/src/component/mod.rs#L16

Benefit

If accepted, We can invoke functions which contains a param with type list

Implementation

Just add a pub prefix

Alternatives

May be no alternatives available?


Last updated: Nov 22 2024 at 16:03 UTC