Hi everyone, the compiler gave me this error.
What am I doing wrong ?
use tauri::api::dialog::confirm;
// 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)
}
#[tauri::command]
fn set_name(name: &str) -> String {
format!("name : {}! ", name)
}
fn main() {
tauri::Builder::default()
.on_window_event(|event|{
match event.event() {
tauri::WindowEvent::CloseRequested{ api,..} =>{
api.prevent_close();
let window = event.window().clone();
confirm(Some(&event.window()),"Close"," Close?", move| answer|{
if answer{
window.close();
}
})
},
_ => {}
}
})
.invoke_handler(tauri::generate_handler![greet,set_name])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
error[E0432]: unresolved import tauri::api::dialog
--> src\main.rs:2:17
|
2 | use tauri::api::dialog::confirm;
| ^^^^^^ could not find dialog
in api
For more information about this error, try rustc --explain E0432
.
error: could not compile emanpro
(bin "emanpro") due to 2 previous errors
this is on win10 with tauri 1.6.1
IDE:vscode
compile error
tauri1.6.1 Examples:
https://docs.rs/tauri/1.6.1/tauri/api/dialog/fn.confirm.html