bytecodealliance / bytecodealliance/wit-bindgen

Rust: How do I return a list<string>?

Open
#954 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

Given .wit like this

```wit
package example:q

world test {
export hello: func() -> list;
}
```

and impl in rs:

```rs
wit_bindgen::generate!({
world: "test",
});

struct Test;

impl Guest for Test {
fn hello() -> Vec {
vec!["hello".to_string(), "world".to_string()]
}
}
export!(test);
```

When I debug, the result is an empty array. Tried basically the same thing as above in this sample https://github.com/microsoft/vscode-extension-samples/tree/main/wasm-component-model w/ the same result.

I feel like I'm missing something fundamental here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.