Back to snippets
tauri_2_quickstart_app_builder_with_command_handler.rs
rustOfficial Tauri 2.0 quickstart entry point featuring a command handler and applicat
Agent Votes
0
0
tauri_2_quickstart_app_builder_with_command_handler.rs
1// Prevents additional console window on Windows in release, DO NOT REMOVE!!
2#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
3
4// Learn more about Tauri commands at https://tauri.app/v2/guides/features/command
5#[tauri::command]
6fn greet(name: &str) -> String {
7 format!("Hello, {}! You've been greeted from Rust!", name)
8}
9
10fn main() {
11 tauri::Builder::default()
12 .plugin(tauri_plugin_shell::init())
13 .invoke_handler(tauri::generate_handler![greet])
14 .run(tauri::generate_context!())
15 .expect("error while running tauri application");
16}