0.1.0-1-alpha.2-fix.2
This commit is contained in:
39
crates/apps/game-reflex-poc-tauri/src/tauri.rs
Normal file
39
crates/apps/game-reflex-poc-tauri/src/tauri.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
// file: crates/apps/game-reflex-poc-tauri/src/tauri.rs
|
||||
// version: 1
|
||||
|
||||
#[tauri::command]
|
||||
fn get_runtime_label() -> String {
|
||||
return crate::runtime_label().to_string();
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn frontend_ready() {
|
||||
crate::record_frontend_ready();
|
||||
return;
|
||||
}
|
||||
|
||||
fn configure_plugins(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tauri::Wry> {
|
||||
let tracing_plugin = tauri_plugin_tracing::Builder::new().build::<tauri::Wry>();
|
||||
return builder.plugin(tracing_plugin);
|
||||
}
|
||||
|
||||
#[allow(clippy::question_mark_used)] // Tauri generates the question-mark operator internally for command dispatch.
|
||||
fn configure_commands(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tauri::Wry> {
|
||||
return builder.invoke_handler(tauri::generate_handler![get_runtime_label, frontend_ready]);
|
||||
}
|
||||
|
||||
/// Runs the Reflex Tauri desktop application.
|
||||
pub fn run() -> std::result::Result<(), String> {
|
||||
tracing::info!(
|
||||
target: "games::tauri::reflex",
|
||||
action = "runtime_start",
|
||||
"Starting Reflex Tauri runtime"
|
||||
);
|
||||
let builder = tauri::Builder::default();
|
||||
let builder = configure_plugins(builder);
|
||||
let builder = configure_commands(builder);
|
||||
return match builder.run(tauri::generate_context!()) {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user