How to return a list of String from a function? (Vec<String>)

I would like to return a list of variable length as the output of a contract function. Below is my code, and it throws the error Error: Invalid u64 data size.

fn get_vec() -> Vec<String> {
       let mut  v: Vec<String> = Vec::new();
        let my_string = String::from_ascii_str("Fuel now.");
        return v;

How do I resolve this?

It seems the issue has already been noted.
What is the ETA for a fix?


Strings in Sway are currently being reworked and so unfortunately I don’t have an estimated timeframe for you. Appreciate you being patient with us @secsec2025! :pray:

1 Like