Skip to content
/ ravel Public

An experimental approach to UI in Rust with a focus on ergonomics, efficiency, and simplicity

License

Notifications You must be signed in to change notification settings

kmicklas/ravel

Repository files navigation

Ravel

Ravel is an experimental approach to UI in Rust with a focus on ergonomics, efficiency, and simplicity.

Semantically, it's in the same family as Elm and React. Like Xilem and SwiftUI, it uses strongly typed view objects with monomorphization to produce efficient code. Operationally, unlike all of these, view objects are never diffed against each other. Instead, views have an associated retained state type, which they update directly.

Similar to Xilem, Ravel tries very hard to play nicely with Rust:

  • Macros are entirely optional
  • Easily write views over borrowed data
  • Event handlers can have direct mutable access to state

Currently we only target DOM with WebAssembly. The design easily generalizes to any retained mode backend framework, and I'd like to support other platforms eventually (especially TUI and mobile).

Examples

To run the examples, you'll need to install Trunk.

cargo install --locked trunk

The tutorial provides a pedagogically ordered overview of basic features and application structure.

trunk serve examples/tutorial/index.html

The implementation of TodoMVC is a slightly more realistic demo.

trunk serve examples/todomvc/index.html

Roadmap

Features

  • Local state
  • Memoization
  • async actions
  • Support "message"/"reducer" architecture rather than direct model mutation
  • More collection types
  • DOM builder macro for convenience/performance
  • Prerendering/hydration
  • Integration with some web framework
  • Modular CSS (export to CSS after dead code elimination with linker hacks)

Optimization

  • No string serialization for defined elements/attributes
  • Dynamic views without marker DOM comment nodes
  • Fully static string types (no pointer storage/comparison)

Infrastructure

About

An experimental approach to UI in Rust with a focus on ergonomics, efficiency, and simplicity

Topics

Resources

License

Stars

Watchers

Forks

Languages