← ClaudeAtlas

tauri_ipclisted

Use this skill when working on Tauri applications that involve communication between the Rust backend and the JavaScript/TypeScript frontend — including defining commands, invoking them from the frontend, handling events, passing complex types across the IPC boundary, or managing errors across the boundary. Triggers on: "tauri command", "invoke()", "#[tauri::command]", "Tauri IPC", "call Rust from JS", "emit event from Rust", "listen to event in frontend", "tauri::AppHandle", "tauri plugin". Also use when the user asks how to pass data between Rust and TypeScript in Tauri.
feralbureau/luminy · ★ 0 · AI & Automation · score 70
Install: claude install-skill feralbureau/luminy
# tauri_ipc Tauri's IPC (Inter-Process Communication) bridge connects the Rust backend to the JavaScript frontend. All data crossing this boundary is serialized to/from JSON. Understanding this constraint is the key to building reliable Tauri IPC correctly. ## The Mental Model ``` Frontend (TypeScript) IPC Bridge Backend (Rust) ───────────────────── ────────── ────────────── invoke('command', args) → JSON serialize → #[tauri::command] fn ← JSON serialize ← Result<T, E> listen('event', handler) ← JSON serialize ← app_handle.emit_all() ``` Every value that crosses the bridge must be serializable to JSON. This means: - Rust types must implement `serde::Serialize` (for return values) and `serde::Deserialize` (for arguments). - Complex types like `HashMap`, `Vec`, enums, and nested structs all work as long as they derive these traits. - Types that DON'T serialize: raw pointers, `Arc`, `Mutex` (the value inside might), file handles, etc. ## Defining Rust Commands ```rust // src-tauri/src/commands/orders.rs use serde::{Deserialize, Serialize}; use tauri::State; use crate::domain::OrderService; use crate::errors::AppError; // Input: must implement Deserialize #[derive(Debug, Deserialize)] pub struct CreateOrderArgs { pub user_id: i64, pub product_ids: Vec<i64>, pub coupon_code: Option<String>, } // Output: must implement Serialize #[derive(Debug, Serialize)] pub struct CreateOrderResult {