Ruggle is a fork of Roogle, a Rust API search engine that allow for searching functions using type signatures over Rust codebases.
The idea of API search for programming languages isn't novel, Hoogle has been around for more than 2 decades, Roogle itself is 4 years old, OCaml has Sherlodoc, Lean recently announced Loogle!...
The vision for Ruggle is not to just to be yet another API search tool, but become the default mode of search when working on a Rust project, making structural search a first class citizen developer tooling. When searching in a codebase, it is rare that we are without context; however text search forces us to build a textual context when we already have access to much more structural information. The objective of Ruggle is to build this graph of structured information, and allow the user to query it as a better search engine.
Roogle seems to be in public archival mode, that's why I've decided to publish Ruggle as a separate project. There are already some major changes to the project:
- Ruggle is available as a VSCode extension that automatically downloads and starts the Ruggle server
- Ruggle maintains its own vendored
rustdoc_typesfor faster decoding usingbincode - Ruggle allows for automatically indexing and searching through the current Rust project
These are some initial steps for the project, to be followed by better and faster search, better autocomplete in the search bar, a large index of available projects on crates.io, code actions for filling type holes in incomplete Rust programs, as well as more complex queries.
Installation with VSCode is available in the extensions bar and the marketplace as well as through the CLI:
code --install-extension AlperenKeles.ruggleThe first time you run the extension, it will automatically download the server from the latest release. Alternatively, you can download latest release of the server via:
curl -fsSL https://raw.githubusercontent.com/alpaylan/ruggle/main/install.sh | bashThe server is also available in crates.io:
cargo install ruggle-serverOnce you have the server, you can locally run it via:
ruggle-server --host 127.0.0.1 --port 8000By default the server looks for the index in $HOME/.ruggle which you can override with --index <path>.
- Function queries:
fn <name>(<arg-name>: <type>, <arg-name>: <type>) -> <type> - Multi-hop function queries:
(A -> ... -> C) - Scoped queries:
<mod|struct|enum> <symbol>: <funtion-query>, - Macro queries
- Primitive types
- Generic types
- Without bounds and where predicates (e.g.,
<T>) - With bounds (e.g.,
<T: Copy>) - With where predicates
- Without bounds and where predicates (e.g.,
- Custom types
- Without generic args (e.g.,
IpAddr) - With generic args (e.g.,
Vec<T>,Option<T>)
- Without generic args (e.g.,
- Other types
- Rust analyzer integration for realtime updates to the index for the current Rust project
- Faster search with better search indexes, currently all search is O(N)
- Better search heuristics, deprioritizing functions that are too loosely typed
- Better search UX, autocomplete existing symbols
- Code actions for filling typed holes, autocomplete suggestions based on the expected type vs the type of the cursor term
After starting the server, visit http://localhost:8000/ for a simple search UI. It lets you:
- Choose a
scopefrom/scopes - Enter a
query - Adjust
limitandthreshold - See results with names, breadcrumb paths, convenient doc links
Build and run the CLI, you can both run an standalone search and request to an existing server:
$ cargo run --bin ruggle-cli -- --scope set:libstd --query "fn (Option<Result<T, E>>) -> Result<Option<T>, E>>"When asking the server, you set --host for the server URL.
$ cargo run --bin ruggle-cli -- --host "http://127.0.0.1:58034" --scope crate:tracing:0.1.41 --query "fn (Option<Result<T, E>>) -> Result<Option<T>, E>>"Flags: --host (default http://localhost:8000), --scope, --limit, --threshold, --json.
The extension lives in vscode-ruggle/.
cd vscode-ruggle && npm package package && code --install-extension ./ruggle-0.0.2.vsix- Command Palette: "ruggle: Search APIs"
There are a variety of settings including: ruggle.host, ruggle.scope, ruggle.limit, ruggle.threshold, ruggle.server.