Uses old Rust 2015
|0.1.8||Nov 16, 2019|
|0.1.7||Aug 18, 2019|
|0.1.6||Dec 24, 2018|
|0.1.5||Sep 18, 2018|
|0.1.2||Apr 29, 2018|
#597 in Development tools
37 downloads per month
A Rust source browser. Explore your Rust project with semantic understanding of the code. Features:
- syntax highlighting
- jump to def (click on a reference)
- find all references (click on a definition)
- smart identifier search
- types (and field info) on hover
- smart usage highlighting
- find all impls (right click on a type or trait name)
- jump to docs for standard library references
- directory browsing
- symbol browsing
Uses knowledge from the RLS.
This is work-in-progress, pre-release software, expect bugs and plenty of rough edges.
Hover to show the type of an identifier:
Search for an identifier name (shows definitions, and all references to each definition):
Find all uses of a definition:
Right click an identifier to show more options
Installing and running
Requires a nightly version of Rust.
To install, run
cargo install cargo-src.
Then, to run:
cargo src in a directory where you would usually run
You can run
cargo src --open to open the output of
cargo src directly in your
cargo src will start a web server and build (
cargo check) and index your code.
This may take some time (depending on your crate, up to twice as long as a normal
build). You can browse the source in whilst indexing, but you'll be missing all
the good stuff like jump-to-def and search.
rustw.toml file in your project's directory. See src/config.rs
cargo src -- -h for the options available and their defaults.
Some features need configuration in the rustw.toml before they can be used.
edit_command = "subl $file:$line"
To be able to open files in your local editor. This example works for sublime
subl). Use the
$line variables as appropriate for your
vcs_link = "https://github.com/nrc/rustw-test/blob/master/$file#L$line"
For links to the code in version control, GitHub, in the example.
Requires a nightly version of Rust.
Get the source code from https://github.com/nrc/cargo-src.
- Install the dependencies:
- Build the JS components:
npm run buildor
- Build the Rust parts:
cargo build --release
CARGO=cargo /<your local filepath>/rustw/target/release/cargo-src in your
project's directory (i.e., the directory you would normally use
cargo src will 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 list the directories and files from your project, which you can then
use to view the code. The terminal is only used to display logging, it can
You can use
--open to open the cargo src browser directly in your web browser.
Currently, cargo src has only been tested on Firefox on Linux and MacOS (issue 48).
If you get an error like
error while loading shared libraries while starting
up cargo src 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
Cargo src is open source (dual-licensed under the Apache 2.0 and MIT licenses) and contributions are welcome! You can help by testing and reporting issues. Code, tests, and documentation are very welcome, you can browse all issues or easy issues to find something to work on.
If you'd like help or want to talk about cargo, you can find me on the rust-dev-tools irc channel (nrc), email (my irc handle @mozilla.com), or twitter (@nick_r_cameron).
The cargo src server is written in Rust and uses Hyper. It runs
cargo check as
a separate process and only really deals with output on stdout/stderr.