Unsure how I am going wrong here, but..
main.rs
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
pub mod commands;
use crate::commands::greeting::greeting;
#[tauri::command]
fn greet(name: String) {
greeting(&name);
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error whilst running tauri application");
}
commands/mod.rs
pub mod greeting;
commands/greeting.rs
pub fn greeting(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
app.tsx
async function greet() {
setGreetMsg(await invoke("greet", { name }));
}
Can you help?