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.
Works on any type your toolchain knows about: primitives, standard library
types, and generic combinations of them. Support for third-party crate types
(e.g. serde_json::Value) is not yet implemented.
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
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 rather than a static list.
Including nightly-only APIs, deprecated methods, and blanket trait impls.
Table of Contents
Requirements
- A Rust toolchain (stable or nightly)
rust-analyzeron your PATH:
- Go-To-Definition also requires
rust-src
Installation
Usage
)
()
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
More examples:
Because it uses rust-analyzer under the hood, the output reflects your actual installed toolchain. Including trait methods, blanket impls, deprecated methods, and nightly-only APIs. Not a static list.
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 so you're not scrolling through docs for 200 methods at once:
Also works in interactive mode. Select a method and the doc comment prints below the signature. Examples shown in next section.
Interactive picker
Pass -i / --interactive instead of a filter to get a live fuzzy selector:
# ---snip---
Type to narrow the list, arrow keys to move, Enter to select: prints the method name and full signature. Esc to quit without selecting.
Combine with --doc to also show the doc comment for the selected method:
Example: Output when I type bitor:
)
# Examples
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.
Pair it with -i to first discover the method you want, then open it:
How it works
For each query, rust-meth:
- Creates a temporary Cargo project in
/tmpwith a probe file:
use *;
// ... other common std imports ...
-
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.