Skip to main content

ToolRegistry

Struct ToolRegistry 

Source
pub struct ToolRegistry { /* private fields */ }
Expand description

Registry of built-in tool definitions.

Implementations§

Source§

impl ToolRegistry

Source

pub fn new(user_tools: BTreeMap<String, ToolDefinition>) -> Self

Create a new registry with user-defined tools.

Source

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.

Source

pub fn contains(&self, tool_id: &str) -> bool

Check if a tool ID is valid (either user-defined or built-in).

Source

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.

Source

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.

Source

pub fn resolve(&self, tool_id: &str, slot: ToolSlot) -> Option<&ToolDefinition>

The tool definition a configured tool id runs in slot, if any.

Source

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.

Source

pub fn list_tools(&self) -> Vec<&str>

List all available tool IDs.

Trait Implementations§

Source§

impl Default for ToolRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more