rust-desktop-applications by bobmatnyc/claude-mpm-skills
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill rust-desktop-applicationsRust 已成为构建桌面应用程序的首选语言,它兼具原生性能与内存安全。生态系统提供了两种主要方法:用于混合 Web UI + Rust 后端应用的 Tauri(类似于 Electron,但体积小 10 倍,速度快 10 倍),以及用于纯 Rust 界面的原生 GUI 框架,如 egui、iced 和 slint。
Tauri 彻底改变了桌面开发,使开发者能够使用 Web 技术(React、Vue、Svelte)构建前端,同时利用 Rust 的性能和安全性进行系统级操作。Tauri 应用的打包体积小于 5MB,内存使用量仅为 Electron 的十分之一,提供了桌面级的性能。原生框架在特定用例中表现出色:egui 适用于即时模式工具和游戏编辑器,iced 适用于 Elm 风格的反应式应用,slint 适用于嵌入式设备和声明式 UI。
本技能涵盖了完整的 Rust 桌面开发生命周期,从框架选择到架构、状态管理、平台集成和部署。您将构建生产就绪的应用程序,具备正确的 IPC 模式、异步运行时集成、原生系统访问和跨平台分发能力。
当构建需要原生性能、小打包体积、系统集成或内存安全保证的桌面应用程序时启用。具体适用于:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在前端和后端之间复制逻辑,或绕过 IPC 进行直接访问,都违反了架构原则。
选择您的框架
cargo install tauri-cli初始化项目
# Tauri
cargo create-tauri-app my-app
# 选择:npm, React/Vue/Svelte, TypeScript
# 原生(egui 示例)
cargo new my-app
cargo add eframe egui
设置架构
src-tauri/src/main.rs 中定义命令,处理 IPCsrc/(后端),ui/ 或 src-ui/(如果是 Tauri 则为前端)实现核心功能
#[tauri::command] 定义 Tauri 命令Result<T, E> 添加错误处理添加平台集成
构建与分发
# 开发
cargo tauri dev # 或 cargo run
# 生产构建
cargo tauri build # 为当前平台创建安装程序
# 跨平台:使用 GitHub Actions 进行矩阵构建
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 当:具备 Web UI 专业知识,需要现代前端框架,快速迭代。 使用原生 GUI 当:追求极致性能,无需 Web 依赖,需要专门的 UI 模式。
提供详细指南:
正确的 Tauri 模式:
✅ 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()
正确的原生 GUI 模式:
✅ Immediate mode (egui) or retained mode (iced)
✅ State updates trigger redraws
✅ Event handling in Rust
✅ Platform-agnostic rendering
✅ Resource cleanup on drop
错误的模式:
❌ 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
性能指标:
生产示例:
Rust 桌面开发提供了无与伦比的性能与内存安全。
选择 Tauri 用于 Web UI + Rust 后端,打包体积极小。选择原生 GUI 用于纯 Rust 项目,具备专门的模式。采用清晰的前端/后端分离架构。使用类型安全的 IPC。集成 Tokio 处理异步。妥善处理平台差异。尽早进行跨平台测试。
这就是 Rust 桌面开发之道。
每周安装数
110
仓库
GitHub 星标数
18
首次出现
Jan 23, 2026
安全审计
安装于
codex91
opencode91
gemini-cli90
claude-code87
github-copilot83
cursor81
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)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.
Weekly Installs
110
Repository
GitHub Stars
18
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
codex91
opencode91
gemini-cli90
claude-code87
github-copilot83
cursor81
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
116,600 周安装
OpenAI DALL-E 3 图像生成命令行工具 - 哥特式大教堂预设与批量生成指南
206 周安装
Social-push:自动化多平台社交媒体内容发布工具,支持小红书、微博、X等
205 周安装
SystemVerilog 开发指南:FPGA/ASIC 设计验证、时序优化与功耗管理
207 周安装
ln-761 密钥扫描器 - 检测代码硬编码密钥与凭据的安全工具
214 周安装
生命周期审计器:应用程序启动、关闭与探针自动化审计工具
210 周安装
ln-301-task-creator:基于AI的自动化任务创建器,支持Linear集成与DRY代码检查
212 周安装
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