rust-meth
Discover the methods available on any Rust type — with fuzzy filtering, inline
docs, interactive selection, and go-to-definition into the standard library
source. Powered by rust-analyzer.
Think of it as "method completion for any Rust type, anywhere in your terminal."
[!IMPORTANT]
- Standard Toolchain: Fully supported (
std,core, andalloc).- External Crates: Supported via the
--depsflag (see 3rd party crates).
Highlights
- Inspect any type's methods and full signatures
- Fuzzy-filter results with partial or typo-ridden input
- Show doc comments inline with
--doc - Browse methods interactively with
-i - Jump to the stdlib source of any method with
--gd - Open that definition directly in your
$EDITORwith--open - Open official documentation directly in your browser with
--open-doc - Query 3rd party crate types with
--deps
Why it's useful
Rust already gives you editor-side go-to-definition, but that only works inside
an open project. rust-meth works anywhere — no project, no editor, no LSP
session. Stay in the terminal while you discover methods, read signatures, and
jump into the stdlib source. Because it uses rust-analyzer under the hood, the
output reflects your actual installed toolchain: trait methods, blanket impls,
deprecated methods, and nightly-only APIs. Not a static list.
Table of Contents
Requirements
- A Rust toolchain (stable or nightly)
rust-analyzeron yourPATH:
rust-src(Rust standard library source code):
[!NOTE] While
rust-analyzerwill typically attempt to install the standard library source automatically, installing it manually ensures it is present.
Installation
Usage
First run may take a few seconds while rust-analyzer indexes the toolchain.
)
()
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
More examples:
Fuzzy filter
The filter argument uses fuzzy matching, so typos and partials work:
)
&) &) &) &) &) &) &) )
Results are sorted by match quality, best first.
Inline documentation
Pass --doc / -d to print the doc comment below each method signature:
)
# Panics
## Overflow behavior
)
Works best combined with a filter:
Also works in interactive mode — select a method and its doc comment prints below the signature.
Interactive picker
Pass -i / --interactive instead of a filter to get a live fuzzy selector:
Type to narrow the list, arrow keys to move, Enter to select. Esc to quit.
Combine with --doc to also show the doc comment for the selected method:
Example output when typing bitor:
✔ Methods on `u8` · bitor
bitor fn(self, Rhs) -> <Self as BitOr<Rhs>>::Output
Go to definition
Pass --gd <method> to find where a method is defined in the standard library
source:
&
Add --open / -o to jump straight to that line in your $EDITOR:
# opens uint_macros.rs at line 902 in $EDITOR
Supports hx / helix, nvim, vim, emacs, and code. Any editor that
accepts +LINE file on the command line will also work.
Requires the rust-src component and $EDITOR to be set:
# or nvim, vim, etc.
Discovery Workflow
Pair it with -i to discover first, then open:
Open in browser
Pass --open-doc with --gd <method> to open the official documentation for
that method directly in your browser:
Works for primitives, stdlib structs, and collections:
[!NOTE]
--openand--open-docare mutually exclusive optionsLimitation:
--gdcurrently only works for standard library types. Go-to-definition for 3rd party crate methods is not yet supported.
3rd party crates
Use the --deps flag to query methods on types from external crates:
)
&) &) &) &) &) &) &) &)
)
Works with all features:
# Interactive mode
# Fuzzy filter
# Show documentation
Multiple dependencies:
Complex dependency specifications:
[!NOTE] The
--depsflag accepts raw TOML syntax exactly as it would appear inCargo.toml. First-time queries with external crates may take longer (5-10 seconds) asrust-analyzerdownloads and indexes the dependencies. Subsequent queries will be faster.
How it works
For each query, rust-meth:
- Creates a temporary Cargo project in
/tmpwith a probe file:
use *;
// ... other common std imports ...
- If
--depsis provided, adds those dependencies to the probe'sCargo.toml - Spawns
rust-analyzeras a subprocess - Performs the LSP handshake (
initialize→initialized→textDocument/didOpen) - Waits for RA to finish indexing, then sends
textDocument/completionat the dot - Filters the response for
CompletionItemKind::Methoditems - Prints names and signatures, then shuts RA down
The temporary project is cleaned up automatically on exit.