Returning a vector from the contract

How do I create a contract function that returns a vector?

I’m trying to use the following structure but I’m getting an error:

I get a generic error:

Returning Vecs directly is not supported as of now - you’ll need to use raw slices. You’ll need to change the return type to raw_slice (note the lack of element type) and call .as_raw_slice() on your result before returning.

If you need to turn a raw_slice into a Vec<Item>, use Vec::from. See this test project on fuels-rs for an example.

1 Like

hmm, that seems to work


Now I have a new problem, when I try to run the command to create the pro front types, I get the following error:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.