- Home
- Skills
- Zhanghandong
- Rust Skills
- Rust Trait Explorer
rust-trait-explorer_skill
- Shell
565
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill zhanghandong/rust-skills --skill rust-trait-explorer- SKILL.md5.8 KB
Overview
This skill helps Rust developers discover trait implementations and inspect which traits a type implements using LSP and simple workspace searches. It returns implementor lists, code snippets, locations, and an implementation coverage summary to speed understanding of polymorphic design. Use it interactively with a trait or type name to get a structured map of implementations and derived traits.
How this skill works
The skill locates a trait or type definition (via LSP goToDefinition or workspace symbols) and runs goToImplementation or pattern searches like "impl * for Type" to find matches. For each impl it collects document symbols and source ranges, extracts method definitions, and generates tables and small code excerpts. It can also detect derives, blanket impls, and build a simple trait hierarchy and coverage checklist.
When to use it
- Find every implementor of a trait to understand code paths and behavior.
- List all traits implemented by a struct or enum for API and serialization checks.
- Audit implementation completeness and detect missing methods or default fallbacks.
- Visualize trait inheritance and blanket impls affecting a type.
- Prepare for refactoring by mapping polymorphic relationships.
Best practices
- Run on the trait or type symbol from a file open in the workspace to ensure LSP resolution.
- Combine LSP results with a grep search for impl blocks to catch edge cases (macros, generated code).
- Review extracted method snippets to verify behavioral differences between implementors.
- Use the coverage table to prioritize tests for implementors missing optional APIs.
- When dealing with macros or proc-macros, inspect the expanded code or generated files if LSP misses impls.
Example use cases
- /rust-trait-explorer Handler — list all types that implement Handler with locations and method summaries.
- /rust-trait-explorer MyStruct — enumerate derived and manual traits and show impl block locations.
- Inspect trait hierarchy for Error-like traits to understand error propagation and conversions.
- Run a coverage check on a trait to see which implementors rely on default methods vs. custom implementations.
- Detect blanket impls (e.g., ToString via Display) that implicitly apply to many types.
FAQ
Fallback to workspace grep for "impl .* for <Type|Trait>" and check generated/expanded code; proc-macro output may not be indexed by LSP.
Can it show method-level differences between implementors?
Yes — it extracts method signatures and small code excerpts for each impl so you can compare implemented behavior and note overrides or defaults.