pub struct ToolRegistry { /* private fields */ }Expand description
Registry of built-in tool definitions.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn new(user_tools: BTreeMap<String, ToolDefinition>) -> Self
pub fn new(user_tools: BTreeMap<String, ToolDefinition>) -> Self
Create a new registry with user-defined tools.
Sourcepub fn get(&self, tool_id: &str) -> Option<&ToolDefinition>
pub fn get(&self, tool_id: &str) -> Option<&ToolDefinition>
Get a tool definition by ID.
Checks user tools first, then falls back to built-in tools.
Sourcepub fn contains(&self, tool_id: &str) -> bool
pub fn contains(&self, tool_id: &str) -> bool
Check if a tool ID is valid (either user-defined or built-in).
Sourcepub fn lint_mode(&self, tool_id: &str) -> Option<BuiltinLintMode>
pub fn lint_mode(&self, tool_id: &str) -> Option<BuiltinLintMode>
Lint behavior for tool_id.
None for a user-defined tool: the user wrote its command and lint_args, so it
is run as written and its output parsed, whatever the tool is.
Sourcepub fn resolve_id(&self, tool_id: &str, slot: ToolSlot) -> Option<String>
pub fn resolve_id(&self, tool_id: &str, slot: ToolSlot) -> Option<String>
The registry id a configured tool id runs as in slot, if any.
A bare name is tried against the slot’s own variants first (tombi in a format
slot runs tombi:format), then as written. Config validation and execution both
go through here, so a tool id rumdl accepts at load time is the same one it runs.
Sourcepub fn resolve(&self, tool_id: &str, slot: ToolSlot) -> Option<&ToolDefinition>
pub fn resolve(&self, tool_id: &str, slot: ToolSlot) -> Option<&ToolDefinition>
The tool definition a configured tool id runs in slot, if any.
Sourcepub fn fills_format_slot(&self, tool_id: &str) -> Option<bool>
pub fn fills_format_slot(&self, tool_id: &str) -> Option<bool>
Whether the tool tool_id resolves to in a format slot can format.
None when the id resolves to nothing. A user-defined tool always answers
true: the user wrote its command, so rumdl has no opinion about what it does.
Every built-in has documented [ToolKind] metadata (pinned by the invariant
tests below), which is what decides the answer for one.
Sourcepub fn list_tools(&self) -> Vec<&str>
pub fn list_tools(&self) -> Vec<&str>
List all available tool IDs.