rust-meth
rust-meth is a type-first method discovery tool for Rust.
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).
Workspace Structure
rust-meth is a Cargo workspace. The CLI (rust-meth) is the user-facing binary;
the core analysis logic lives in the rust-meth-lib library crate.
| Crate | Path | Description |
|---|---|---|
rust-meth |
cli/ |
CLI binary — argument parsing, output, interactive UI |
rust-meth-lib |
lib/ |
Library — rust-analyzer integration, type resolution, method lookup |
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 in your browser with
--open-doc - Query 3rd party crate types with
--deps - Colorized output, JSON output, and call snippets
- Explain any method's full documentation with
--explain
Requirements
- A Rust toolchain (stable or nightly)
rust-analyzeron yourPATH:rust-src(for go-to-definition):
Installation
Usage
For full flag reference and detailed examples, see the sections below.
Table of Contents
- Fuzzy filter
- Inline documentation
- Interactive picker
- Go-to-definition
- Open in browser
- Explain a method
- 3rd party crates
- Call snippets
- JSON output
- How it works
- License
Fuzzy filter
The filter argument uses fuzzy matching — 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:
Also works in interactive mode.
Interactive picker
Pass -i / --interactive to get a live fuzzy selector:
Type to narrow, arrow keys to move, Enter to select, Esc to quit.
Go to definition
Pass --gd <method> to find where a method is defined in the stdlib source:
# u8::checked_add library/core/src/num/uint_macros.rs:902
# opens uint_macros.rs at line 902 in $EDITOR
Supports hx, nvim, vim, emacs, and code. Requires $EDITOR to be set.
Open in browser
Pass --open-doc with --gd to open the official docs in your browser:
[!NOTE]
--openand--open-docare mutually exclusive.--gdcurrently only works for standard library types.
3rd party crates
For types where the crate name matches the type path prefix, --deps can be omitted:
Use --deps to pin a version or add features:
[!NOTE] First-time queries may take 5–10 seconds as
rust-analyzerdownloads and indexes dependencies.
Explain a method
Pass --explain <method> to print the full documentation for a specific method
directly in the terminal — no browser required:
Output includes the method signature and its complete rustdoc comment, untruncated:
method: unwrap_unchecked
sig: unsafe fn(self) -> T
│ Returns the contained `Ok` value, consuming the `self` value,
│ without checking that the value is not an `Err`.
│
│ # Safety
│
│ Calling this method on an `Err` value is undefined behavior.
│
│ # Examples
│ ...
Pass --browser to open the official documentation page instead:
[!NOTE] Unlike
--open-doc,--explain --browserdoes not require--gdand skips the definition lookup step, making it faster for quick doc lookups.
Call snippets
Pass --snippet to print each method as a ready-to-paste call site:
# const fn(self, u8) -> u8
# → x.wrapping_add(u8)
#
# const fn(self) -> u8
# → x.wrapping_neg()
JSON output
Pass --json for machine-friendly output (pipe into jq, scripts, etc.):
Each item includes name, detail (full signature), and documentation.
How it works
See ARCHITECTURE.md and the lib crate README.