Table of Contents
Applications written in Rust
Command-line argument parsing
Date and time
A web frontend for the Rust compiler 。
rustwA web frontend for the Rust compiler. Displays errors in an easily readable, concise layout, gives easy access to more information, quickly allows reading or editing code.
Be warned: very work in progress!
live demo. Be warned that it is very, very slow since it is running on a crappy server and rustw is not designed to be run over the internet. When run locally, it is much snappier.
- Better errors - we should have interactive experiences for exploring and visualising errors involving the borrow checker, macros, etc. Also, easy access to error explanations and docs.
- Explore code - provide a platform for searching and understanding source code.
- Convenience - one click (or keystroke) to rebuild, easy to edit and explore code, GUI for multirust (in some ways this is a minimal IDE experience, focused on building, rather than editing).
- setup the React/webpack environment (requires npm):
npm install # if you have yarn installed: yarn # if not: npm install --save react react-dom redux react-redux redux-thunk npm install --save-dev babel-loader babel-core npm install --save-dev babel-preset-react npm install --save-dev babel-preset-es2015 npm install --save-dev babel-plugin-transform-object-rest-spread npm install --save-dev webpack npm install --save-dev immutable
- build the JS components:
npm run buildor
cargo build --releaseto build the Rust parts.
rustwin your project's directory (i.e., the directory you would normally use cargo or rustc from).
rustwwill start a web server and display a URL in the console. To terminate the server, use
ctrl + c. If you point your browser at the provided URL, it will build your project, output will be displayed in your browser. The terminal is only used to display some logging, it can be ignored. See tour for more.
Currently, rustw has only been tested on Firefox on Linux (issue 48).
If you want to play with cool features like 'jump to definition', see the customisation below.
error while loading shared librarieswhile starting up rustw you should try the following:
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$DYLD_LIBRARY_PATH
rustw.tomlfile in your project's directory. See src/config.rs or run
rustw -hfor the options available and their defaults.
Some features need configuration in the rustw.toml before they can be properly used. Set the following properties to use the cool stuff:
This means rustw will run rustc with
save_analysis = true
-Zsave-analysis, this gives you access to analysis information from the compiler which is used in
jump to defintion, types on hover, refactoring, etc.
To be able to open files in your local editor. This example works for sublime text (
edit_command = "subl $file:$line"
subl). Use the
$linevariables as appropriate for your editor.
For links to the code in version control.
vcs_link = "https://github.com/nrc/rustw-test/blob/master/$file#L$line"
To rebuild, reload the page (quickest way is to hit F5) or click the
You'll see a summary of errors and warnings. You can hide the details (notes, etc.) by clicking the
-buttons. You can show code snippets by clicking the
+buttons next to filenames. This will show syntax highlighted code with the source of the error (or note, etc.) highlighted. If you click on the filename itself, it will take you to a source code view of that file. You can right click these links to bring up a menu, here you have options to edit the file (which opens the file in an editor which must be specified in
rustw.toml) or make a 'quick edit', which pops up a text box to edit the code in the browser.
You can click error codes to see explanations。