RustView
A Streamlit/Gradio equivalent for pure Rust. Write a plain Rust function, and RustView turns it into a live browser UI -- no HTML, no JavaScript, no frontend build step.
The project is under active development. The core widget set and layout system are usable today, but the API is not yet stable. Expect breaking changes before a 1.0 release.
Quick Start
Add the dependency (currently from git):
[]
= { = "https://github.com/EdgeTypE/rustview.git" }
Write your app:
use *;
Run it:
# opens http://127.0.0.1:8501
Features
RustView ships 56+ widgets across these categories:
| Category | Widgets |
|---|---|
| Input | text_input, int_slider, slider, checkbox, button, toggle, radio, select, selectbox, multi_select, text_area, number_input, int_input, color_picker, date_picker, file_upload, image_upload |
| Output | write, heading, subheading, caption, markdown, code, json, table, dataframe, metric, progress, spinner, divider, badge, link |
| Alerts | success, warning, info, error, toast |
| Media | image, audio, video, download_button |
| Layout | container, sidebar, columns, tabs, expander, row, modal, empty |
| Forms | form, form_submit_button |
| Charts | line_chart, bar_chart, scatter_chart, histogram |
| Theming | Theme struct with CSS custom properties |
Full API docs: docs/widgets.md
Examples
Four runnable examples are included:
Configuration
use RustViewConfig;
let config = RustViewConfig ;
run_with_config;
Themes are customizable through a Theme struct:
use ;
let config = RustViewConfig ;
State Management
Every widget remembers its value across re-renders automatically. For
user-defined state, use get_state and set_state:
Interface Mode
For simple input-to-output functions, the Gradio-style Interface API avoids
writing any UI code:
use *;
Architecture
RustView uses a thin-client / server-rendered model:
- An Axum HTTP server runs the app function and maintains a virtual DOM per session.
- On each user interaction the server diffs the old and new trees and sends JSON patches over SSE or as a POST response.
- A small (~4 KB) vanilla JS shim in the browser applies patches and forwards events back to the server.
- Session state is stored in-memory with a configurable TTL (default 24 hours).
- The
#[cached]proc-macro can cache expensive computations across renders.
See docs/architecture.md for a detailed walkthrough.
Testing
The TestUi harness lets you unit-test apps without starting a server:
use TestUi;
Roadmap
The list below reflects what exists today and what is planned. Items may shift depending on community feedback.
Done
- Core widget set (56+ widgets across input, output, layout, charts)
- Immediate-mode rendering with virtual DOM diffing
- Session state and user-defined state
- SSE-based live updates
#[cached]proc-macro- Custom theming
- Interface mode (Gradio-style single-function UIs)
- TestUi harness for unit testing
Near-term
- Publish to crates.io
- Stabilize the public API and release v0.1 as a proper crate
- Add accessibility attributes (ARIA roles, keyboard navigation)
- WebSocket transport option alongside SSE
- File download improvements (streaming large files)
Medium-term
- Component system for reusable widget groups
- Persistent state backends (SQLite, Redis)
- Authentication and multi-user session isolation
- Client-side routing for multi-page apps
- More chart types (area, candlestick, heatmap)
Long-term
- Plugin API for third-party widgets
- Deployment helpers (Docker image, systemd unit)
- Optional WASM compilation for offline-capable apps
Requirements
- Rust 1.75 or newer
- Edition 2021
Contributing
See CONTRIBUTING.md for setup instructions, coding guidelines, and how to submit a pull request.
License
MIT OR Apache-2.0