2024 Rust跨平台ui框架 Rust Cross Platform UI Library
仓库数据 Repo Status
框架 | Stars | Issue | 版本 | 活跃程度 |
---|---|---|---|---|
Tauri | Star | Issue | ||
egui(bevy) | Star | Issue | ||
Slint | Star | Issue | ||
Iced | Star | Issue | ||
Dioxus | Star | Issue | ||
Relm4 | Star | Issue | ||
Flutter rust bridge | Star | Issue |
支持平台 Supported Platform
部分条目可能更新不及时,请自行到项目主页查看。
框架 | 🌐网页 | 📱安卓/iOS | 💻PC | 嵌入式 | 额外 |
---|---|---|---|---|---|
Tauri | ✔ | ✔beta | ✔ | Servo | |
egui/bevy | ✔ | ✔安卓TODO | ✔ | ||
Slint | ✔⏳ | TODO | ✔⏳ | ✔ | |
Iced | ✔ | ✔ | |||
Dioxus | ✔ | ✔ | ✔ | 终端 Phoenix LiveView (服务端渲染HTML) |
|
Relm4/GTK4 | ✔ | ||||
Flutter | ✔ | ✔ | ✔ | ✔ |
ps: Servo 由Mozilla撑腰的嵌入式浏览器项目,如果能与Tauri结合,就能一套Tauri代码走天下了。
原理介绍 Intro
官网/demo/模板 | 底层 | 开发支持 | 缺陷 | 商用 |
---|---|---|---|---|
Tauri | 本机webview | web项目:Vite(Vue),Next.js,SvelteKit,HTML+CSS+JS | Apache-2.0 | |
egui/demo | bevy | Apache-2.0 | ||
bevy/demo | Apache-2.0 | |||
Slint/demo | API: C++,JS,Rust | GPLv3,免版税,商业版 | ||
Iced | MIT | |||
Dioxus/demo | Apache-2.0 | |||
Relm4/template | GTK4 | Apache-2.0 | ||
Flutter/cookbook | Canvas | dart | BSD-3 |
特色功能 Features
框架 | 热重载 实时预览 |
多窗口 |
---|---|---|
Tauri | ✔ | ✔TAO |
egui/bevy | 仅资源 | ✔示例 |
Slint | ✔ | ✔issue |
Iced | issue | issue |
Dioxus | ✔ | (0.2.x) |
Relm4 | ✔ | |
Flutter | ✔ |
前端web框架
create-tauri-app时,看到也能用rust写前端,但如果要快速开发、快速更改需求,还是用传统的js框架写吧(vite)
rust的第三方ui库没有多少,而vue3甚至还有低代码生成器。
wasm打包比js更小!
做高性能本机应用时,可以考虑用rust写前端,如storyboarder这类的项目。
leptos
sycamore
yew
vanilla
参考 References
https://www.reddit.com/r/rust/comments/10sqmz3/tauri_vs_iced_vs_egui_rust_gui_framework/
https://www.reddit.com/r/rust/comments/15vron7/tauri_vs_slint_vs_dioxus_vs/
bevy+tauri 多窗口
https://github.com/tauri-apps/tauri/issues/3662
多窗口实践
bevy in tauri:
https://willhart.io/post/headless-bevy-in-a-tauri-app/
tauri(wry) in bevy:
https://github.com/blaind/bevy_webview/issues
tauri:
https://github.com/tauri-apps/tauri/issues/6482
https://github.com/tauri-apps/tauri/discussions/6274
https://github.com/tauri-apps/tao/issues/545
https://stackoverflow.com/questions/74594524/can-i-store-and-restore-size-and-window-position-for-multiple-windows-in-tauri
bevy:
https://stackoverflow.com/questions/63652767/how-with-bevy-can-you-get-and-set-window-information-after-creation
https://bevyengine.org/examples/Window/window-resizing
框架 | ||
---|---|---|
Tauri | ||
egui/bevy | ||
Slint | ||
Iced | ||
Dioxus | ||
Relm4 | ||
Flutter |
想法
Tauri背靠web生态,Slint占用低+嵌入式,bevy做3D渲染
Popup Virus(Windows Crazy Error):
bevy做3D,tauri做特殊弹窗,slint做普通弹窗(因为实例较多)
先做tauri多标签/透明
<-bevy
,再做反向的bevy<-tauri<-bevy画布
tao管理窗口,多个slint窗口实例,最多4个bevy/tauri实例
TODO:
tao<slint窗口+窗口移动+鼠标移动+桌面背景(potplayerXP,开源win,mac,开源安卓,ios)+提前渲染好mp3,native事件/声效
读取MIDI来控制时间轴,事件同步系统
反向支持winxp(bevy,slint,tauri)
Tauri/bevy透明
网页内弹窗Vue + bevy弹窗(纸牌赢之后缓冲区不刷新的绘制)
任务管理器不能结束