The Tauri docs say that a return value from a command handler can be of any type as long as it implements serde::Serialize.
As a very basic modification of the default tauri + yew example project I modified in my tauri application a plain String return type with a struct as follows:
#[derive(Serialize, Deserialize)]
struct Data {
demo: String
}
so that the command becomes
#[tauri::command]
fn greet(name: &str) -> Data {
Data{demo: "demo".to_owned()}
}
The yew front-end unfortunately seems to return None now where before the msg was successfully converted into a String:
new_msg = invoke(
"greet",
to_value(&GreetArgs { name: &*name }).unwrap(),
)
.await;
log(&new_msg.as_string().unwrap());