Thank you for considering a contribution to RustView. This document explains how to set up the project, run tests, and submit changes.
- Rust 1.75 or newer
- Git
Clone the repository and make sure everything builds:
git clone https://github.com/EdgeTypE/rustview.git
cd rustview
cargo build
cargo testThe workspace has two crates:
rustview(root) -- the main library and serverrustview-macros-- procedural macros (#[cached])
Four example applications are included under examples/:
cargo run --example hello # minimal app
cargo run --example counter # session state
cargo run --example dashboard # multi-column layout
cargo run --example showcase # every widget in one pageEach example starts an HTTP server on http://127.0.0.1:8501.
src/
lib.rs -- public API and prelude
ui.rs -- Ui struct, all widget methods
widgets/mod.rs -- HTML render functions for each widget
vdom/mod.rs -- VNode tree and diffing
server/mod.rs -- Axum routes, SSE, JS shim, CSS
session/mod.rs -- per-tab session store
cache/mod.rs -- computation cache
testing/mod.rs -- TestUi harness
interface.rs -- Gradio-style Interface API
docs/ -- user-facing documentation
examples/ -- runnable example apps
tests/ -- integration tests
- Create a feature branch from
main. - Keep commits focused -- one logical change per commit.
- Add or update tests for any new behavior. The test suite currently has over 220 unit tests and 3 integration tests.
- Run
cargo testandcargo clippybefore pushing. - If your change affects the public API, update the relevant file in
docs/.
Run the full suite:
cargo testFor a specific module:
cargo test --lib widgets # widget render tests
cargo test --lib ui # Ui method tests
cargo test --test '*' # integration tests onlyThe TestUi harness in src/testing/mod.rs lets you unit-test apps without
starting a server. See docs/testing.md for patterns and examples.
- Follow standard
rustfmtformatting. - Prefer returning values from widgets rather than using callbacks.
- Keep the JavaScript shim in
server/mod.rsminimal. It currently weighs around 12 KB with no external dependencies. - CSS class names use the
rustview-prefix. CSS custom properties use--rustview-.
User-facing docs live in the docs/ directory. If you add a new widget or
change an existing API, update docs/widgets.md or the relevant guide. The
docs/README.md table of contents should stay in sync with the file list.
- Push your branch and open a pull request against
main. - Describe what the change does and why.
- Make sure CI passes (build + tests).
- A maintainer will review and may request changes.
Open an issue on GitHub. Include:
- What you expected to happen
- What actually happened
- Steps to reproduce (ideally a small code snippet)
- Rust version (
rustc --version)