This tool tries to visualize Rust's memory management, especially ownership transfer and borrows. Aiming to make these concepts easier to grasp for beginners, and experienced programmers switching from other languages.
This project is part of my master's thesis at the Julius-Maximilians-University Würzburg, so the main focus is currently on finishing the thesis, not adding more features and fixing bugs ( feel free to do so, though :) )
For now it is a standalone program, but IDE integration may be something to look into for the future.
- no borrow checker (no dependency unstable rust compiler hooks, or polonius).
- no (/limited) error visualizations. However, the visualizations should still be useful while debugging borrow checker errors.
- complex lifetime annotations: rust analyzer does not lower lifetime annotations properly yet, meaning that any
struct test<'a, 'b> {}
will be treated asstruct test<'a, 'a> {}
async
unsafe
(interior mutability, inline assembly, etc.)- bugs
- this was my first rust project, so coding style is probably suboptimal in many cases :)
boris_shared
: data structures shared between the backend analysis, and rendering codeboris_analysis
: the core analysis code, depending on rust analyzerboris_renderer
: code for rendering the analysis resultsboris_app
: a standalone app, combining the analysis backend with a very basic frontend windowboris_viewer
: a WASM compatible frontend, for embedding into websites (without the analysis backend)boris_exporter
: an internal tool for exporting/serializing analysis outputs, and creating graphics for the thesis
App:
cargo run -p boris_app --release
to run the main application
WASM Viewer:
- run
trunk serve
in theboris_viewer
folder for running the web viewer application locally. More information about deploying can be found here. - the viewer directly embeds pre-analysed function bodies from the
./example/export/bodies/
folder (see./project/boris_viewer/examples.rs
) - access examples via
url/#example_name
(e.g., https://christianschott.github.io/boris-viewer/#ownership)
- RustViz
- Aquascope
- Graphical depiction of ownership and borrowing in Rust
- Think Spatially to Grok Lifetimes
- Rust Lifetime Visualization Ideas
- Flowistry
- REVIS
It is based on the powerful rust-analyzer crate, making this whole project even possible. For the rendering it utilizes egui, as it provided a very fast and simple way for drawing to the screen.