🦀 The ultimate search extension for Rust

Overview

Rust Search Extension

简体中文

The ultimate search extension for Rust

Chrome Web Store Mozilla Add-on Microsoft Edge license-mit license-apache Discord

Search docs, crates, builtin attributes, official books, and error codes, etc in your address bar instantly.

https://rust.extension.sh/

Installation

Features

  • Search Primitive Types and Modules
  • Search Structs, Traits and Enums
  • Search Functions, Methods and Macros
  • Search builtin attributes
  • Search nightly docs
  • Search crates on https://crates.io or https://lib.rs
  • Search any third-party crate's docs
  • Search Compiler Error Index with error codes
  • Search Rust official book chapters
  • Search Cargo Clippy lints
  • Search Caniuse.rs and RFC
  • Offline mode supported, search local Rust docs (rustup docs --std)
  • Builtin commands (:yet, :book, :stable, :label, :tool, :mirror, :update and :history etc)
  • Docs.rs enhancements (display Feature flags)
  • Github rust-lang release page enhancements (show table of content)
  • docs.rust-lang.org enhancements (link all "since" and "issue" label)

How to use it

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

demonstration.gif

Diagram

diagram

Contribution

jsonnet is required before getting started. To install jsonnet, please check jsonnet's README. For Linux users, the snap is a good choice to install jsonnet.

$ git clone --recursive https://github.com/huhu/rust-search-extension
Cloning into 'rust-search-extension'...
$ cd rust-search-extension

$ make chrome # For Chrome version

$ make firefox # For Firefox version

$ make edge # For Edge version

Get involved

  • You can contact us on Discord Channel: https://discord.gg/xucZNVd
  • Or by adding the Wechat ID: huhu_io, we'll invite you to our Wechat group.

Miscellaneous

Thanks

Thanks for the sponsorship from these great companies.

Comments
  • docs.rs sometimes don't allow you to go to the top of the page

    docs.rs sometimes don't allow you to go to the top of the page

    I am using Firefox 90.0.2 64bit on win10. I was on https://docs.rs/object/0.26.0/object/ and couldn't go to the top of the page, it just scrolls down again. After uninstalling the extension (or going private mode) it fixes itself.

    bug 
    opened by ZetaNumbers 13
  • In Chrome, search begins but goes back to default Google search when a key is pressed

    In Chrome, search begins but goes back to default Google search when a key is pressed

    • I type rs and space/tab into the address bar.
    • "Rust Search Extension | " appears.
    • I start typing, but it immediately goes back to the default Google search.

    2021-01-30 15 54 49

    It was working fine the last time I used it ~2 weeks ago. I've tried restarting Chrome, disabling and reenabling the extension.

    Google Chrome 88.0.4324.96 (Official Build) (x86_64) macOS Catalina 10.15.7 (19H114)

    opened by allenap 8
  • Bug: Extension opens /update page every browser launch

    Bug: Extension opens /update page every browser launch

    Every time I open chrome, the rust -search-extension is opening the https://rust.extension.sh/update page in a tab, regardless of any tabs(including itself) that were open on last chrome launch.

    Steps to reproduce:

    1. Install chrome
    2. Install rust-search extension
    3. Toggle Auto-update to On
    4. Close all browser windows
    5. Re-open Chrome
    6. See a https://rust.extension.sh/update tab
    7. Repeat steps 4-6 to witness issue persist

    image image

    OS: Ubuntu 20.04 x64(Linux) Browser: Chrome Version 87.0.4280.141 (Official Build) (64-bit)

    enhancement 
    opened by RileyMShea 7
  • Don't require people to explicitly add crates for their docs.rs page to be accessible

    Don't require people to explicitly add crates for their docs.rs page to be accessible

    It'd be nice if you didn't need to explicitly click the "⊕ to Rust Search Extension" button on a crate's docs.rs page in order to search for items inside it.

    Expected Behaviour

    If you enter rs @itertools::XXX it would first try to find the corresponding page if already added and indexed, falling back to opening the search page (https://docs.rs/itertools/?search=XXX).

    Actual Behaviour

    Typing rs @itertools::Itertools and hitting <enter> just clears the search box and does nothing.

    Typing rs !itertools::Itertools will navigate to https://docs.rs/releases/search?query=itertools%3A%3AItertools, i.e. it tries to find the itertools::Itertools crate in docs.rs.

    opened by Michael-F-Bryan 7
  • Add additional Rust official books?

    Add additional Rust official books?

    Hi, it looks like there are some books that seem to be missing from the extension search which might be useful to add. Is this the complete list of supported books? https://github.com/huhu/rust-search-extension/blob/master/rust/src/tasks/books.json

    From looking at https://www.rust-lang.org/learn :

    • Rustdoc book: https://doc.rust-lang.org/rustdoc/index.html
    • Rustc book: https://doc.rust-lang.org/rustc/index.html
    • Command-line application book: https://rust-cli.github.io/book/index.html

    If you'd be interested, I could open a PR to add these to the extension, in particular I think I would find the rustc book helpful to have easily searchable.

    enhancement 
    opened by ian-h-chamberlain 4
  • [feature request] search all docs both in std or external crates by default

    [feature request] search all docs both in std or external crates by default

    Currently, we have to use special prefix(~) to search external crates, it would be great if this extension would search both std docs and external crates by default (or at least provide a setting).

    opened by jiacai2050 4
  • Stopped working on Firefox 93

    Stopped working on Firefox 93

    Hi,

    since recently the extension does not work anymore for me. Entering "rs something" in the address bar and pressing enter results in the address bar being cleared but nothing else is happening.

    Sebastian

    opened by surban 4
  • Offline mode does not work in Firefox

    Offline mode does not work in Firefox

    I am using Firefox 84.0.1 on Manjaro and have rust-docs installed. I enabled offline mode and set the path to file:///usr/share/doc/rust/html/. Search itself works fine: for example, when I type "rs result" into the search box, it shows me a bunch of results with correct local paths, such as file:///usr/share/doc/rust/html/std/fmt/type.Result.html. But when I hit Enter, nothing happens. I tried the same with Chromium and everything works fine.

    opened by burjui 4
  • Searching external crates is not supported

    Searching external crates is not supported

    Hey. I got sent here when I removed the extension again. The feature I'm looking for is to search e.g. Tokio or futures docs for a certain term. I currently have firefox search bookmarks that allow this, but they just show the search results, and don't jump directly to the item, which is what I hoped this would allow me to do.

    opened by Darksonn 4
  • The features dropdown buttons moves the

    The features dropdown buttons moves the "Go to latest version" button" after page load

    usually on docs.rs, when you visit an outdated version docs page of a crate, we get this orange colored warning "Go to latest version" button on top left.

    image

    but this extension moves the features dropdown button to the left of that yellow warning button. this happens after the page loads, so when i see the warning and try to click the "Go to latest version" link, I accidentally click the features button often. image

    this happens because of the delay between the page loading and the extension doing its magic.

    this happens very often and frustrates me every time :(

    Ideally, it would keep the features button where it already is, so that the orange Go to latest version button doesn't get pushed around.

    opened by coderedart 3
  • Fix latest version parsing for crates with hyphens in their name

    Fix latest version parsing for crates with hyphens in their name

    Crates with hyphens have their version extracted from the DOM (when viewing the latest version of a crate and adding it to the extension's index) incorrectly.

    For example, adding the latest embedded-hal release to the extension's index results in this:

    Screen Shot 2022-02-11 at 2 00 39 AM

    This in turn causes the extension to produce invalid docs.rs links.


    This snippet (which itself addressed fallout from rustdoc changing its version output) is the problematic bit:

    https://github.com/huhu/rust-search-extension/blob/599b1c9a312751e3cfeef02e5f39d393aa091ba3/extension/script/add-search-index.js#L12-L15

    Updating this to take the last element after splitting on - instead of the second fixes this case but I think this leaves other edge cases unhandled.

    For example, cargo and friends allow for pre-release versions which are allowed to have hyphens (i.e. 0.0.1-my-extremely-unstable-release). While it's unlikely that the docs.rs "latest" link for a crate will redirect to one of these, it is still possible – docsrs will search stable, unyanked releases first but will fall back to pre-releases.

    The wasi crate is one such example of this (no "stable" releases as of this writing, pre-release version has a hyphen in it: 0.11.0+wasi-snapshot-preview1).


    Reverting to the previous method (grabbing the version from the sidebar) and changing the query to 'nav.sidebar .version' is general enough to support pages generated before and after the rustdoc version change without being too general (and potentially picking up things in user-added HTML snippets) I think. This is the change I have implemented.

    The downside to this approach is that it doesn't work on rustdoc output that predates the addition of the version in the sidebar; since docs.rs doesn't rebuild docs for older releases this can be a real concern for older stable crates that haven't had a release in a while.


    Another approach is to snoop through some of the relative links on the page and to extract the version from the relative URLs there. There doesn't seem to be an obvious thing in the DOM to go after and we're definitely still susceptible to changes in rustdoc this way; I'm not sure if this is worth doing.

    Yet another option is to pick an approach based on the rustdoc version in rustdoc-vars (i.e. document.querySelector("#rustdoc-vars").getAttribute("data-rustdoc-version")). This could help a little but it's worth noting that it itself is a relatively recent addition to the rustdoc HTML output, I think.

    If either of the above or some other approach are preferable, please let me know; I'm happy to update this PR.

    opened by rrbutani 3
  • Extension suddenly broke in Firefox

    Extension suddenly broke in Firefox

    I'm using Firefox 108.0.1 and the most recent version of the add-on, which is 1.9.1. The experience in Firefox with the add-on has always inferior to the experience in Chrome for me (search results sometimes not showing up properly, pressing Enter on a search result sometimes just leads you to a different page?, etc.), but generally it's been working fine. Since today it's not showing me any search results anymore though. When I type in the rs prefix, it's still showing me the rust search extension suggestion, but it doesn't seem to actually find the proper link:

    image

    Even actions that don't require any actual querying don't work:

    image

    (When I press enter on the highlighted suggestion, nothing happens)

    I haven't changed any configuration/settings, and I don't think my Firefox had any updates. The search extension is also still working just fine in Chrome.

    (Sidenote, but is it possible to set up the search extension as a Firefox search engine somehow, so that you can just press Tab after typing the rs prefix and then only get rust search results? It's doing that by default in Chrome for me, but not in Firefox)

    opened by Sp00ph 1
  • Make it easier to navigate to extension documention

    Make it easier to navigate to extension documention

    https://rust.extension.sh contains useful information on how to use this extension so it would be nice to be able to navigate there easily without remembering the url.

    Perhaps a link on the main page of the extension? image

    enhancement 
    opened by Imberflur 0
  • [Firefox] Does not work in the similar way like other search extensions.

    [Firefox] Does not work in the similar way like other search extensions.

    Hello, thanks in advance for this extension!

    However, I find that this extension does not work in the similar way like other search extensions on Firefox.

    For example, this is the one for GitHub. 圖片

    And we can customize the keywords for it in the browser preference. 圖片

    However, for this rust-search extension.

    1. We cannot customize the keywords.
    2. type rs and tab in the address tab bar does not work. rs and space still works.
    圖片

    It might be due to different manifest keywords between Firefox and Chromium browsers? (I have not created a chrome extension before).

    The following is some search extension for Amazon I wrote for Firefox before. Not sure this extension works in similar ways.

    {
        "manifest_version": 2,
        "name": "Amazon Smile Search",
        "description": "Add Amazon Smile to your search engine. ",
        "version": "1.0",
        "chrome_settings_overrides": {
            "search_provider": {
                "name": "Amazon Smile",
                "search_url": "https://smile.amazon.com/s?k={searchTerms}",
                "keyword": "@amazon",
                "favicon_url": "https://smile.amazon.com/favicon.ico",
                "is_default": false,
                "encoding": "UTF-8"
            }
        }
    }
    

    Firefox version: Firefox Developer Edition (107.0b8)

    opened by fuyu0425 3
  • Add sidebar sections to Table of Content

    Add sidebar sections to Table of Content

    When I'm on a type's doc page and it has a lot of methods, it's tedious to scroll the sidebar to Trait implementations or other sections (could also ctrl+F, but that's also not that convenient).

    It would be useful to add the links to these sections to the Table of Content widget.

    opened by jakubdabek 2
  • Search should be case sensitive

    Search should be case sensitive

    Expected Behaviour

    1. I type in rs Eq.
    2. I hit enter.
    3. I am taken to the docs for std::cmp::Eq.

    Actual Behaviour (on Firefox for me at least)

    1. I type in rs Eq.
    2. I hit enter.
    3. I am taken to the docs for std::ptr::eq.

    This seems undesirable.

    enhancement 
    opened by Victor-N-Suadicani 3
Releases(v1.9.1)
  • v1.9.1(Nov 27, 2022)

  • v1.9.0(Nov 20, 2022)

    • Migrate to chrome.storage.onChange event to avoid add docs index failure (#206).
    • Support search space-separated keywords.
    • Cache feature flags in session storage.
    • New commands:
      • :rustc - Search rustc codegen options and lints.
      • :target - Search rust target for three tiers.
    image
    • Add a pagination tip in the last page item.
    • Remove prefix for RFC (??) & Improve docs (#197).
    • Condense attributes and crates index size.
    • Make feature flag's name sticky left.
    • Bugfix:
      • Fix error code regex.
      • Fix incorrect export of stats/history (#203) (#204).
      • fix docs.rs show features (#209).
      • Fix source code navigate bug. Fix (#212).
      • Fix GitHub release page TOC compatibility (#214).

    Thanks for the contributions from @shwin0901, @light4, and @xxchan.

    Source code(tar.gz)
    Source code(zip)
  • v1.8.2(Oct 30, 2022)

  • v1.8.1(Aug 18, 2022)

    • Remove file:///* permission. Fixes (#190).
    • Add Show Macro Railroad options.
    • Use rustwiki Chinese CDN. (#191)

    Thanks for the contributions from @PureWhiteWu.

    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(Aug 14, 2022)

    image

    • Support options page. Fixes (#133).
    • Replace 'crate:check' action with chrome.storage API query.
    • Support the new search-index loading, see rust-lang/rust#98124.
    • Add more books into :book command. Thanks .
    • Add :book/zh command to list Chinese books. (#175).
    • Adjust margin of add to extension button (#178).
    • Remove uninstall url. Close (#188).
    • Bugfix:
      • Fix default offlineDocPath undefine bug.
      • Don't load search index in non-rust doc pages
      • Invalid cached crate searcher after crate search index updated or removed.

    Thanks for the contributions from @C-Dao, @zjp-CN, and @ZhangHanDong.

    Source code(tar.gz)
    Source code(zip)
  • v1.7.0(Jun 5, 2022)

    • Remove the tabs permission requirement.
    • Migrate localStorage to chrome.storage API (#155, #157, #158).
    • Support update blog command posts index in update page.
    • Bugfix:
      • Fix docs.rs TOC max-width and padding.
      • Only render .top-doc headings as TOC. Fixes #152.
      • Don't reposition feature flag menu. Fixes #154.
      • Fix search base iterate issue (#159).
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Mar 2, 2022)

    • Show optional dependencies in the feature flags menu. Fixes #29. optional-dependencies
    • Fix the latest version parsing for crates with hyphens. Thanks for contribution #147 from @rrbutani.
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Jan 25, 2022)

    • Support customize default search items in settings. Fixes #141. image
    • Add docs outline highlight. Thanks for contribution #140 from @NaturelLee.
    • Bugfix:
      • Fix update label/RFC index bug.
      • Fix add to extension button toggle float issue.
      • Fix crate version parse bug.
      • Fix docs.rs TOC render and UI
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Nov 1, 2021)

    • New commands:
      • :rfc: show all Rust RFC list.
    • Improvements:
      • Error code search supports offline mode.
      • Expand the :stable command result to 100 versions.

    What a coincidence! Rust will release v1.87.0 on its 10th anniversary day!

    • Bugfix:
      • Fix docs.rs TOC overlap issue.
      • Fix weeks, hours, and dates statistics bug.
      • Fix percent statistics NAN bug. fix #125.
      • Fix % books search some invalid urls bug.

    https://rust.extension.sh/changelog/

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Jul 30, 2021)

    • Unify Settings, Statistics into manage pages, additionally, you can also:
      • Manage your all indexed crates.
      • Import/Export your settings, search history, statistics, and crates data.
    • Support offline mode in Windows.
    • Show Table of Content in docs.rs.
    • Improvements:
      • Only keep the latest 100 search histories.
      • Ignore legacy rust std docs, such as v0.12.0.
    • Bugfix:
      • Fix fail to add some crate into the extension issue. Fix #114, #119, #120.

    https://rust.extension.sh/changelog/

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Mar 27, 2021)

    • Support prefix // (double slash) to search rustc crates docs. 👉 Learn more.
    • Support search released Rust versions quickly. 👉 Learn more.
    • Add source code mode (with src: or with alias s:) to open the source code page directly. 👉 Learn more.
    • New commands:
      • :blog: show all Rust release blog posts.
    • Improvements:
      • Add a reminder for Firefox offline mode on the popup page. Fix #94.
      • Add fallback search strategy for @crate search. Fix #96.
      • Only open update page once a day if the auto-update is on. Fix #97.
      • Add more useful tips for the :help command.
      • Compress history's JSON data slightly.
    • Bugfix:
      • Fix the compatibility for the new style of search-index.js format. Fix #106.
      • Fix the compatibility of search-index.js on-demand load mode. See this commit eefa192c.
      • Add validation when auto index std search-index. Fix #99.
      • Fix compatibility issue of the new const-since link in Rust docs page.
      • Fix search statistics bug for https://docs.rs/releases data.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0-rc(Mar 21, 2021)

  • v1.1.0(Jan 5, 2021)

    • Docs.rs is now the ! search, crates.io is !!. See issue #85.
    • Refactor search statistics page (finer granularity for search metrics)
    • Add a table of content for the rust-lang repository release page
    • docs.rust-lang.org enhancement: in stable/nightly docs page and source code pages, link all "since" and "issue" tags to corresponding URLs
    • Show a crate's Cargo.toml quick link when feature flag is empty
    • New commands:
      • :cargo: show all useful cargo subcommands
      • :release: open rust-lang repository release page
    • Bugfix:
      • Fix dark theme color compatibility in docs.rs
      • Fix #89, official feature flags menu compatibility
      • Fix #84, feature flags not working in some crate's docs.rs page
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Oct 31, 2020)

    Finally, we reach v1.0! 🎉🎉

    • Support sync stable/nightly std search index automatically. There is no extension updating required to get the latest search index after v1.0.
    • Support prefix ? and ?? to search caniuse.rs and RFC respectively. Thanks the PR from @aquarhead.
    • Upload the latest index files to the update page once a day, those index including:
      • Command index
      • Book index
      • Clippy lint index
      • Caniuse index
      • Github rust-lang/rust repository label index
      • Top 20K crate index
    • Support configure auto index-updating in the popup page
    • New commands:
      • :stats: open search statistics page
      • :update: open the update page to sync the latest index automatically
    • Bugfix:
      • Fix docs.rs SVG icon missing issue
      • Fix docs.rs new header bar UI compatibility
    Source code(tar.gz)
    Source code(zip)
  • v0.10.0-rc(Jun 2, 2020)

  • v0.9.0-rc(Apr 16, 2020)

cargo extension that can generate ebuilds using the in-tree eclasses

cargo-ebuild cargo ebuild is a Cargo subcommand that generates an ebuild recipe that uses cargo.eclass to build a Cargo based project for Gentoo Insta

Doug Goldstein 79 Dec 12, 2022
Browser tab search provider for GNOME

What is this ? This is repository provides browser tab search provider for GNOME Screenshot Installation Installl all 3 components for tab search to w

Harshad 28 Dec 20, 2022
Detects usage of unsafe Rust in a Rust crate and its dependencies.

cargo-geiger ☢️ A program that lists statistics related to the usage of unsafe Rust code in a Rust crate and all its dependencies. This cargo plugin w

Rust Secure Code Working Group 1.1k Dec 26, 2022
Powerful database anonymizer with flexible rules. Written in Rust.

[Data]nymizer Powerful database anonymizer with flexible rules. Written in Rust. Datanymizer is created & supported by Evrone. What else we develop wi

[Data]nymizer 381 Dec 26, 2022
⚡️Lightning-fast linter for .env files. Written in Rust 🦀

⚡️ Lightning-fast linter for .env files. Written in Rust ?? Dotenv-linter can check / fix / compare .env files for problems that may cause the applica

null 1.5k Jan 9, 2023
Rust Code Completion utility

Racer - code completion for Rust RACER = Rust Auto-Complete-er. A utility intended to provide Rust code completion for editors and IDEs. Maybe one day

null 3.4k Jan 4, 2023
Format Rust code

rustfmt Quick start On the Stable toolchain On the Nightly toolchain Installing from source Usage Running cargo fmt Running rustfmt directly Verifying

The Rust Programming Language 4.8k Jan 7, 2023
The Rust toolchain installer

rustup: the Rust toolchain installer Master CI Build Status Windows macOS Linux Etc rustup installs The Rust Programming Language from the official re

The Rust Programming Language 5.1k Jan 8, 2023
Repository for the Rust Language Server (aka RLS)

Rust Language Server (RLS) The RLS provides a server that runs in the background, providing IDEs, editors, and other tools with information about Rust

The Rust Programming Language 3.6k Jan 7, 2023
a freeform Rust build system

tinyrick: a freeform Rust build system .---. ^ o{__ω__ o{ ^0^ -Let me out! ~~ ( // *|* \xx\) xx`|' = =

Andrew 48 Dec 16, 2022
The Curly programming language (now in Rust!)

Curly Curly is a functional programming language that focuses on iterators. Some of its main implementation features include sum types, iterators, lis

Curly Language 30 Jan 6, 2023
Some WIP payload in Rust running on M1.

m1saka Some WIP payload in Rust running on M1. Project informations The aim of this payload is to provide exploration capabilities while providing a s

Mary 10 Mar 7, 2021
A library to compile USDT probes into a Rust library

sonde sonde is a library to compile USDT probes into a Rust library, and to generate a friendly Rust idiomatic API around it. Userland Statically Defi

Wasmer 39 Oct 12, 2022
⚙️ Workshop Publishing Utility for Garry's Mod, written in Rust & Svelte and powered by Tauri

⚙️ gmpublisher Currently in Beta development. A powerful and feature-packed Workshop publisher for Garry's Mod is finally here! Click for downloads Ar

William 484 Jan 7, 2023
compile rust code into memes

cargo-memex Besides their size, rust binaries have a significant disadvantage: rust binaries are not memes yet. cargo-memex is a cargo subcommand that

Matthias Seitz 243 Dec 11, 2022
A neofetch alike program that shows hardware and distro information written in rust.

nyafetch A neofetch alike program that shows hardware and distro information written in rust. installing install $ make install # by default, install

null 16 Dec 15, 2022
Automated license checking for rust. cargo lichking is a Cargo subcommand that checks licensing information for dependencies.

cargo-lichking Automated license checking for rust. cargo lichking is a Cargo subcommand that checks licensing information for dependencies. Liches ar

Nemo157 120 Dec 19, 2022
Create target folder as a RAMdisk for faster Rust compilation.

cargo-ramdisk This crate is only supported for unix like systems! cargo-ramdisk creates a ramdisk at the target folder of your project for ridiculousl

PauMAVA 20 Jan 8, 2023
A small utility to compare Rust micro-benchmarks.

cargo benchcmp A small utility for comparing micro-benchmarks produced by cargo bench. The utility takes as input two sets of micro-benchmarks (one "o

Andrew Gallant 304 Dec 27, 2022