pub struct ToolExecutor { /* private fields */ }Expand description
Executor for running external tools.
Caches tool availability checks for efficiency.
Implementations§
Source§impl ToolExecutor
impl ToolExecutor
Sourcepub fn new(default_timeout_ms: u64) -> Self
pub fn new(default_timeout_ms: u64) -> Self
Create a new executor with the given default timeout.
Timeouts are tallied process-wide, so a tool that hangs is attempted a bounded number of times across every file of a run rather than once per file.
Sourcepub fn isolated(default_timeout_ms: u64) -> Self
pub fn isolated(default_timeout_ms: u64) -> Self
Create an executor that tallies timeouts only for itself.
For callers that must not inherit or contribute to the process-wide tally, such as tests, where one test’s hanging tool would otherwise decide whether another test’s tool is run at all.
Sourcepub fn is_tool_available(&self, tool_name: &str) -> bool
pub fn is_tool_available(&self, tool_name: &str) -> bool
Check if a tool is available (lazy, cached).
Sourcepub fn execute(
&self,
tool_def: &ToolDefinition,
input: &str,
is_format_mode: bool,
timeout_ms: Option<u64>,
) -> Result<ToolOutput, ExecutorError>
pub fn execute( &self, tool_def: &ToolDefinition, input: &str, is_format_mode: bool, timeout_ms: Option<u64>, ) -> Result<ToolOutput, ExecutorError>
Sourcepub fn format(
&self,
tool_def: &ToolDefinition,
input: &str,
timeout_ms: Option<u64>,
) -> Result<String, ExecutorError>
pub fn format( &self, tool_def: &ToolDefinition, input: &str, timeout_ms: Option<u64>, ) -> Result<String, ExecutorError>
Execute a tool for formatting (returns formatted content).
Sourcepub fn lint(
&self,
tool_def: &ToolDefinition,
input: &str,
timeout_ms: Option<u64>,
) -> Result<ToolOutput, ExecutorError>
pub fn lint( &self, tool_def: &ToolDefinition, input: &str, timeout_ms: Option<u64>, ) -> Result<ToolOutput, ExecutorError>
Execute a tool for linting (returns diagnostics).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolExecutor
impl RefUnwindSafe for ToolExecutor
impl Send for ToolExecutor
impl Sync for ToolExecutor
impl Unpin for ToolExecutor
impl UnsafeUnpin for ToolExecutor
impl UnwindSafe for ToolExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more