Sobre
A cross-platform UI framework for writing solid, fluent cross-platform apps.
Desenvolvimento web e de aplicativosCrescimento medido de estrelas
- em 24 h
- -1
- em 7 dias
- Coletando histórico
- em 15 dias
- Coletando histórico
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
Original
Waft
A pure Rust, GPU-accelerated UI framework for building fast, fluid apps.
Waft is a cross-platform UI framework in Rust targeting macOS, Windows, Linux, iOS, Android, and the web — with a clean embedder interface for bringing your own platform.
Why Waft
- Solid foundation: Built on Flutter's proven architecture, Waft ships with rich layout, gestures, animations, and ready to use widget kits from day one.
- Pure Rust, easy to embed: Everything including the render engine builds with a single
cargocommand, behind a clean embedder interface for custom platforms. - Fast & GPU-accelerated: Compiles to a native binary with GPU acceleration — small footprint, fast rendering, and instant startup.
- Cross-platform: One codebase for macOS, Windows, Linux, iOS, Android, and the web, with an easy-to-use CLI to run and package for each target.
- First-class desktop: Built for real desktop apps with native menus, multi-window support, single-instance locking, and packaging for DMG, MSI, DEB, and AppImage.
- Hardware compositing & media: Video, camera previews, and cross-process surfaces run as native OS compositor layers with zero app repaints.
- Built for coding agents: Built-in debugging and UI-driving tools (
cargo waft ext) so agents never need to leave the terminal (waft.rs/agents.md).
Apps built with Waft
|
|
|
|
| Edged 2 | Cupertino gallery | WinUI gallery | Material gallery |
| A window switcher for macOS |
iOS-style widgets, from waft-cupertino |
Desktop and web widgets, from waft-winui |
Material Design 3 widgets, from waft-material |
Start an app
cargo waft is a CLI for scaffolding, running, and packaging Waft apps:
cargo install waft-cli
cargo waft new myapp # --template winui for a desktop app
cd myapp
cargo waft run # this desktop
cargo waft run -d ios # an iOS simulator
cargo waft run -d android # an Android emulator
cargo waft run -d web # a browser
cargo waft build dmg # and macos, ios, ipa, apk, msi, nsis, deb, appimage, web
For more details, see
waft-cli.
Building an app with Waft
Waft keeps a clean interface between the framework and the platform (the embedder). The usual way to start an app is to create an embedder and provide a root widget:
use waft::{DefaultEmbedder, IntoWidget, Shell, run_app};
use waft_cupertino::CupertinoApp;
fn main() {
DefaultEmbedder::default().run(|platform| {
Shell::new(platform, |app| {
run_app(app, CupertinoApp::new().home(Counter).into_widget());
})
});
}
Or use the #[waft::main] macro to write the main function:
use waft::{App, IntoWidget, run_app};
use waft_cupertino::CupertinoApp;
#[waft::main]
fn main(app: &mut App) {
run_app(app, CupertinoApp::new().home(Counter).into_widget());
}
Writing the UI
The framework is a faithful port of Flutter with a large number of widgets available. Use them as you would in Flutter:
use waft::{App, BuildContext, Column, IntoWidget, StatelessWidget, Text, WidgetRef};
#[derive(Debug)]
struct Counter;
impl StatelessWidget for Counter {
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef {
Column::new()
.children([
Text::new("Counter").into_widget(),
Text::new("0").into_widget(),
])
.into_widget()
}
}
State management
Unlike Flutter, Waft has a built-in state management solution, inspired by Zed's GPUI.
App state lives in an Entity. Create one with app.new_entity, read it with read, and change it with update. A read inside a widget's build observes the entity: notify rebuilds that widget.
use waft::{App, BuildContext, Entity, IntoWidget, StatelessWidget, Text, WidgetRef};
let count = app.new_entity(|_cx| 0);
struct Label {
count: Entity<i32>,
}
impl StatelessWidget for Label {
fn build(&self, app: &mut App, _context: BuildContext) -> WidgetRef {
let n = *app.read(&self.count);
Text::new(format!("{n}")).into_widget()
}
}
app.update(&count, |n, cx| {
*n += 1;
cx.notify();
});
Structuring an app
The recommended architecture is three layers:
- Logic: the business logic, as plain Rust. It does not depend on
ApporEntity, so it runs and is tested on its own. - State: the app's state as entities, built on the logic layer. This is where
App,EntityandTimerare used. Entity events model what happens: an entity emits withcx.emit, another subscribes and reacts. A callback from outside the app reaches an entity throughAsyncApp::post. This layer depends onwaft-foundationalone, so it is tested withAppCelland no display. - UI: widgets, kept thin. A widget reads entities in
build, which subscribes it to them, and calls their methods from callbacks. It keeps only view state, such as whether a panel is open.
A new feature is one entity plus the widgets that show it.
Contributing and AI
Waft is developed with strong assistance from AI agents, with humans leading the design, reviewing changes, testing, and remaining responsible for correctness.
AI-assisted contributions are welcome as long as the contributor fully reviews the work, understands how it fits the architecture, manually reviews code changes, and tests the work. Code that the contributor cannot explain, verify, or maintain should not be submitted.
How this repo is worked on: AGENTS.md.
License
MIT
Explore projetos relacionados
Carregando…