If it is possiable,there will easily call notification function by rust code, when program initialize error,we can tell user friendly.
static mut APP: Option<&mut tauri::App> = None;
pub fn set_app()-> Option<&'static mut tauri::App> {
let app = tauri::Builder::default()
.build(tauri::generate_context!())
.expect("error while building tauri application");
let c = Box::new(app);
return Some(Box::leak(c));
}
fn main() {
let A = set_app().unwrap();
unsafe {
//
// This line wil cause error :
// cannot move out of `*A` which is behind a mutable reference
// move occurs because `*A` has type `tauri::App`, which does not implement the `Copy` trait"
//
// But I change A.run to *A.run,it not works
//
A.run(|_app_handle, event| match event {
tauri::RunEvent::ExitRequested { api, .. } => {
api.prevent_exit();
}
_ => {}
});
}
}
Thank you