Configs2026年7月12日·1 分钟阅读

Iced — Cross-Platform GUI Library for Rust

Iced is a cross-platform GUI library for Rust inspired by Elm. It provides a reactive programming model with type-safe messages and a compositor-based renderer for building native desktop applications.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Iced Overview
直接安装命令
npx -y tokrepo@latest install 3a940055-7e30-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Iced brings the Elm Architecture to Rust desktop development. It separates state, messages, and view logic into distinct functions, making UIs predictable and testable. The library renders via wgpu (GPU-accelerated) or a software fallback, producing crisp native-feeling applications on Windows, macOS, and Linux.

What Iced Does

  • Renders GPU-accelerated UIs using wgpu with a software fallback
  • Implements The Elm Architecture with typed messages and an update loop
  • Provides built-in widgets: buttons, text inputs, sliders, scrollable lists, and more
  • Supports async commands and subscriptions for background tasks
  • Enables custom widget creation with a flexible rendering API

Architecture Overview

An Iced application is a loop: the runtime calls view() to build a virtual widget tree, diffs it against the previous frame, and applies minimal updates to the rendered output. User interactions generate Message values routed to update(), which mutates state and optionally returns a Command for async work. The renderer backends (wgpu, tiny-skia) are swappable.

Self-Hosting & Configuration

  • Add iced as a Cargo dependency; no system libraries required on most platforms
  • Enable feature flags for extras: image, svg, canvas, tokio
  • On Linux, ensure Vulkan drivers are installed for GPU rendering or use the software renderer
  • Customize themes via the Theme trait or use built-in light/dark themes
  • Cross-compile with standard Rust toolchain targets

Key Features

  • Type-safe message passing catches UI logic errors at compile time
  • Responsive layout engine handles resizing without manual calculations
  • Built-in async runtime integrates with Tokio for network and file I/O
  • Canvas widget supports custom 2D drawing with paths, text, and images
  • Accessibility support is actively developed with screen reader integration

Comparison with Similar Tools

  • egui — egui uses immediate mode (redraw every frame); Iced uses retained mode with diffing for efficiency
  • Slint — Slint has a declarative markup language; Iced is pure Rust code
  • Tauri — Tauri uses web views for UI; Iced renders natively via GPU
  • GTK-rs — GTK bindings wrap a C library; Iced is written entirely in Rust
  • Druid — Druid is in maintenance mode; Iced is actively developed with a growing community

FAQ

Q: Does Iced support mobile platforms? A: Experimental support exists, but Iced primarily targets desktop (Windows, macOS, Linux) today.

Q: How does performance compare to native toolkits? A: GPU-accelerated rendering makes Iced competitive with native toolkits for most applications, including smooth animations.

Q: Can I use custom fonts and icons? A: Yes. Load custom fonts via Font::with_bytes() and use SVG or image widgets for icons.

Q: Is Iced stable enough for production? A: The API is still evolving between minor versions, but several production applications use Iced successfully.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产