#Working with vectors
1 messages · Page 1 of 1 (latest)
Provided that Serde can serialize the Data type, it will appear as an array in JS. The following examples are identical declarations.
Rust:
struct Data {
field_one: String,
field_two: bool,
}
let data = Data {
field_one: String::from("Hello, World!"),
field_two: true,
};
JS:
let data = {
fieldOne: "Hello, World!",
fieldTwo: true,
};
So as an array in JS, that can be accessed with:
let data = await invoke("feed_data");
let dataStart = data[0].fieldOne;