计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
desktop-applications【效率与协作】Build cross-platform desktop applications with Rust using Tauri framework and native GUI alternatives
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: desktop-applications description: Build cross-platform desktop applications with Rust using Tauri framework and native GUI alternatives user-invocable: false disable-model-invocation: true version: 1.0.0 category: development author: Claude MPM Team license: MIT progressive_disclosure: entry_point: summary: "Build performant cross-platform desktop apps with Tauri (web UI + Rust backend) or native GUI frameworks" when_to_use: "Creating native desktop applications requiring system integration, small bundle sizes, or high performance" quick_start: "1. Choose framework (Tauri vs native GUI) 2. Setup project structure 3. Implement IPC/state management 4. Add platform integration 5. Test cross-platform 6. Build and distribute" references: - tauri-framework.md - native-gui-frameworks.md - architecture-patterns.md - state-management.md - platform-integration.md - testing-deployment.md context_limit: 800 tags:
Rust has emerged as a premier language for building desktop applications that combine native performance with memory safety. The ecosystem offers two main approaches: Tauri for hybrid web UI + Rust backend apps (think Electron but 10x smaller and faster), and native GUI frameworks like egui, iced, and slint for pure Rust interfaces.
Tauri has revolutionized desktop development by enabling developers to use web technologies (React, Vue, Svelte) for the frontend while leveraging Rust's performance and safety for system-level operations. With bundle sizes under 5MB and memory usage 1/10th of Electron, Tauri apps deliver desktop-class performance. Native frameworks shine for specialized use cases: egui for immediate-mode tools and game editors, iced for Elm-style reactive apps, slint for embedded and declarative UIs.
This skill covers the complete Rust desktop development lifecycle from framework selection through architecture, state management, platform integration, and deployment. You'll build production-ready applications with proper IPC patterns, async runtime integration, native system access, and cross-platform distribution.
Activate when building desktop applications that need native performance, small bundle sizes, system integration, or memory safety guarantees. Specifically use when:
TAURI FOR WEB UI + RUST BACKEND | NATIVE GUI FOR PURE RUST | NEVER MIX BUSINESS LOGIC IN FRONTEND
Duplicating logic between frontend and backend, or bypassing IPC for direct access, violates architecture.
Choose Your Framework
cargo install tauri-cliInitialize Project
# Tauri
cargo create-tauri-app my-app
# Select: npm, React/Vue/Svelte, TypeScript
# Native (egui example)
cargo new my-app
cargo add eframe egui
Setup Architecture
src-tauri/src/main.rs, handle IPCsrc/ (backend), ui/ or src-ui/ (frontend if Tauri)Implement Core Features
#[tauri::command]Result<T, E>Add Platform Integration
Build and Distribute
# Development
cargo tauri dev # or cargo run
# Production build
cargo tauri build # Creates installers for current platform
# Cross-platform: Use GitHub Actions with matrix builds
Need desktop app?
├─ Have web frontend skills (React/Vue/Svelte)?
│ └─ YES → Use Tauri
│ ├─ Need <5MB bundles? ✓
│ ├─ System integration? ✓
│ ├─ Cross-platform? ✓
│ └─ Rapid UI development? ✓
│
└─ Pure Rust, no web frontend?
├─ Game editor or immediate mode tools? → egui
├─ Elm-style reactive architecture? → iced
├─ Declarative UI, embedded devices? → slint
└─ Data-first reactive? → druid
Tauri when: Web UI expertise, need modern frontend frameworks, rapid iteration Native when: Maximum performance, no web dependencies, specialized UI patterns
Detailed guides available:
Correct Tauri Pattern:
✅ Commands in Rust backend
✅ Type-safe IPC with serde
✅ Async operations with Tokio
✅ State management with Arc<Mutex<T>>
✅ Error propagation with Result<T, E>
✅ Frontend calls backend via invoke()
Correct Native GUI Pattern:
✅ Immediate mode (egui) or retained mode (iced)
✅ State updates trigger redraws
✅ Event handling in Rust
✅ Platform-agnostic rendering
✅ Resource cleanup on drop
Incorrect Patterns:
❌ Business logic in frontend JavaScript
❌ Exposing unsafe commands without validation
❌ Blocking operations on main thread
❌ Direct filesystem access from frontend
❌ Missing error handling on IPC
❌ Hardcoded platform-specific paths
Performance Metrics:
Production Examples:
Rust desktop development offers unmatched performance with memory safety.
Choose Tauri for web UI + Rust backend with tiny bundles. Choose native GUI for pure Rust with specialized patterns. Architect with clear frontend/backend separation. Use type-safe IPC. Integrate Tokio for async. Handle platform differences. Test cross-platform early.
This is the Rust desktop way.