一键导入
rmc-signature-search
Find Rust fns by signature shape.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Find Rust fns by signature shape.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Preview a Rust symbol rename — exact reference set & refactor probe.
Audit a Rust crate's public API.
Enforce Rust crate-edge rules.
Audit Rust attributes and doc-comments.
Rust fn-level call graphs.
Task-conditioned workspace subgraph — nodes, edges, hierarchy.
| name | rmc-signature-search |
| description | Find Rust fns by signature shape. |
| argument-hint | <filter-expression> [crate-name] |
| allowed-tools | Read, mcp__rust-code-mcp__* |
Recorded FunctionSignature data per fn unlocks signature-shape filtering
at workspace scale: "every async fn returning Result<_, MyError>",
"every fn with ≥5 params", "every fn taking &Path". Scope: single crate
or per-fn signature inspection.
For per-fn forensics (callers, fan-in), use rmc-symbol-forensics. For
attribute-based discovery (#[deprecated], #[must_use]), use
rmc-attribute-audit.
build_hypergraph(directory=<absolute-path>)
function_signature(directory=..., target=<crate>::Y)
Returns the recorded signature: is_async, self_param
(Owned / Ref / RefMut, or null for free / assoc fns without self),
params (each with name, type_string, by_ref, mutability),
return_type, generics (with declaration-site trait bounds).
Type strings come from RA's HirDisplay rendered against the function's
owning crate; allocator / hasher type parameters (, Global>,
, RandomState>, , BuildHasherDefault<...>>) and LazyLock /
OnceLock init-fn pointer parameters are stripped.
functions_with_filter(directory=..., krate=X,
min_param_count=<n>,
has_param_type=<substring>,
returns_type_pattern=<substring>,
is_async=<bool>,
self_kind=<"none"|"owned"|"ref"|"ref_mut">,
limit=50, offset=0,
summary=false)
Knobs:
min_param_count — fns with at least N non-self params.has_param_type — case-sensitive substring against any param's
stringified type (e.g. "&Path", "tokio::sync::Mutex").returns_type_pattern — case-sensitive substring against return type
(e.g. "Result<" — note: substring, not regex).is_async — true for async-only / false for sync-only / omit for
both.self_kind — "none" (free fns + assoc fns without self), "owned"
(self), "ref" (&self), "ref_mut" (&mut self).limit (default 50), offset (default 0).summary=true drops the signature payload from each match — useful
for lightweight enumeration when full signatures exceed MCP token
budget.Sorted by qualified name. Trait-impl method bodies are NOT included (Layer 4 limitation — impl items aren't Item nodes).
total_match_count returned per call. Compare to offset + match_count
to detect "more pages exist". Bump offset by limit until
match_count < limit.
functions_with_filter(krate=X, returns_type_pattern="Result<",
is_async=true, has_param_type="OldError")
Every async fn returning a Result that mentions the legacy error type.
Pair with rmc-call-graph to scope migration per fn.
functions_with_filter(krate=X, self_kind="owned")
Consuming methods (fn foo(self) -> Self) are the builder-pattern
signature. Combine with returns_type_pattern="Self" for a tight builder
filter.
functions_with_filter(krate=X, has_param_type="&Path")
Or has_param_type="PathBuf". Pair with who_uses_summary per finding
to rank by fan-in — top filesystem-touching fns are the natural seam for
an injected FileSystem trait.
For trait T's methods (from module_tree):
function_signature(target=<crate>::T::method)
per method. Compare self_param shape across the trait's method set —
inconsistent self-kind on a trait (some &self, some &mut self, some
owned self) is usually a smell.
For implementors:
functions_with_filter(krate=<impl_crate>, self_kind="ref_mut") and
check whether impl methods match the trait's declared self-kind.
functions_with_filter(krate=X, min_param_count=5)
Refactor candidates — five-or-more params usually wants a struct-of-args,
builder, or splitting. Cross-reference with rmc-complexity for the
containing file — high-arity + high cyclomatic = top refactor priority.
| Goal | Mode |
|---|---|
| Workspace inventory ("list every async Result fn") | summary=true (drops signature payload) |
| Single-fn analysis | function_signature(target=Y) (no filter needed) |
| Migration prep | functions_with_filter(returns_type_pattern=<old type>, is_async=...) |
| Refactor candidate detection | functions_with_filter(min_param_count=5) |
| Self-kind audit | function_signature per method, compare manually |
| Filter combo | Result |
|---|---|
min_param_count=5 | Refactor candidates |
has_param_type="&Path" | I/O surface |
returns_type_pattern="Result<" + is_async=true | Async fallible API |
self_kind="owned" | Consuming / builder methods |
self_kind="none" | Free fns + static assoc fns |
has_param_type="tokio::sync::Mutex" | Async-locked critical sections |
Filter: <expression>
Crate: <X>
Matches: <n> (total <total_match_count>; pages remaining: <bool>)
Per match:
<crate>::Y
is_async: <bool>, self: <kind>, params: <n>, returns: <T>
notes: <hint - e.g. "builder candidate", "I/O seam">
has_param_type and returns_type_pattern are substring matches on
HirDisplay output, not type-aware. Result<MyError> and MyError
both substring-match "MyError" — disambiguation is the caller's job., Global> from Vec<T, Global>) are
trimmed but other defaults may still appear depending on RA's render.impl Trait signatures may differ slightly from source (RA renders the
resolved trait obj, not the source impl Trait syntax).module_tree filtered to impl Items.trait_bounds —
only declaration-site bounds (RA limitation).