You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The closure with the same name seems to be able to replace some command-modified symbols.
How can I read the app variable accessed in the greet function?
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
use std::sync::{Arc, Mutex};
fn main() {
let app = Arc::new(
MyBuilder::new()
.as_server()
.port(8099)
.build()
);
let a = app.clone();
let greet = move |name: &str| -> String {
a.as_server();
format!("Hello, {}! You've been greeted from Rust! {}", name, "xxx")
};
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
app.wait();
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The closure with the same name seems to be able to replace some command-modified symbols.
How can I read the app variable accessed in the greet function?
Beta Was this translation helpful? Give feedback.
All reactions