Skip to content
πŸ¦€ A handy browser extension to search crates and official docs in the address bar (omnibox)
JavaScript Rust HTML
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Add github action build badge Nov 1, 2019
assets Add demonstration gif Nov 28, 2018
extension Bump version to 0.5 Nov 8, 2019
rust Minify javascript null to variable N Nov 16, 2019
.gitignore Add rust directory Nov 13, 2019 Create Nov 26, 2018
LICENSE-MIT Create LICENSE-MIT Nov 26, 2018 Bump version to 0.5 Nov 8, 2019

Rust Search Extension

Chrome Web Store Mozilla Add-on rust-doc license-mit license-apache Build Status

πŸ¦€ A handy browser extension to search crates and docs in the address bar (omnibox).



  • Search Primitive Types and Modules
  • Search Structs, Traits and Enums
  • Search Functions, Methods and Macros
  • Search crates on
  • Search Compiler Error Index with error code
  • Offline mode, search local Rust docs (rustup docs --std) (Some limitation on Firefox, see Caveats)
  • Both Chrome and Firefox are supported


Input keyword rs in the address bar, press Tab or Space to activate the search bar. Then enter any word you want to search, the extension will response the related search results instantly.


How the extension works

1. Build search index

The raw search index was generated by rustc-doc. The most important function is build_index() which located at librustdoc/html/render/

The final search index is an object array like this:

var searchIndex = [
      crate: "std",
      desc: "A hash map implemented with linear probing and Robin Hood bucket stealing.",
      name: "HashMap",
      parent: undefined,
      path: "std::collections",
      ty: 3,
      type: null
      crate: "std",
      desc: "Applies function to the elements of iterator and returns the first non-none result.",
      name: "find_map",
      parent: {ty: 8, name: "Iterator"},
      path: "std::iter",
      ty: 11,
      type: [["self"],["f"]]

2. Build search words array based on search index

The search words array is the list of search words to query against which build from the raw search index. It's just a plain name array of every Rust structs, traits, enums, functions, methods, macros, etc.

var searchWords = [

3. Search keyword in search words array

Using Levenshtein distance algorithm to search matched words, the max Levenshtein distance is 2.

// Max levenshtein distance.

4. Sort search result

Sort search result according to Levenshtein distance, lexicographical and others metrics.

5. Transform search result to suggestion result to show in the address bar

Mapping the search word and search index to generate the search result, build Rust doc link for each result item.

var suggestResults = [
      content: "",
      description: "std::ops::<match>Deref</match> - <dim>Used for immutable dereferencing operations, like `*v`.</dim>"
      content: "",
      description: "std::ops::Deref::<match>deref</match> - <dim>Dereferences the value.</dim>"


1. Why local file: rust doc not work properly on Firefox?

For security reasons, in Firefox, file: URLs is an unprivileged URL, accessing to those unprivileged URLs are prohibited. See the MDN documentation for more detail.

2. Any workaround to support offline mode on Firefox?

Sure. A good choice is use http server! For example using python SimpleHTTPServer module:

$ cd your-rust-doc-directory
$ python -m http.server
Serving HTTP on port 8000 ( ...

Then set as your local doc path.

You can’t perform that action at this time.