master
rs 22 lines 732 Bytes
Raw
1 // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
2 #[tauri::command]
3 fn greet(name: &str) -> String {
4 format!("Hello, {}! You've been greeted from Rust!", name)
5 }
6
7 #[cfg_attr(mobile, tauri::mobile_entry_point)]
8 pub fn run() {
9 tauri::Builder::default()
10 .plugin(tauri_plugin_opener::init())
11 .setup(|#[allow(unused)] app| {
12 // Android-only plugin.
13 #[cfg(target_os = "android")]
14 {
15 app.handle().plugin(tauri_plugin_admob::init())?;
16 }
17 Ok(())
18 })
19 .invoke_handler(tauri::generate_handler![greet])
20 .run(tauri::generate_context!())
21 .expect("error while running tauri application");
22 }