pub trait ToolExecutor: Send + Sync {
// Required methods
fn kind<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ExecutorKind> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn run_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cwd: &'life1 Path,
argv: &'life2 [String],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn grep<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn find<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
glob: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn git<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Execution environment that tools dispatch their effects through.
Implementations: LocalExecutor (local filesystem + process table) and the
sandbox stub (fails with ExecutorError::UnsupportedKind) in the daemon
kernel (theway-daemon); tests and embedded consumers may provide their own.
Required Methods§
Sourcefn kind<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ExecutorKind> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn kind<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ExecutorKind> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reports which execution environment this executor dispatches to, so callers can distinguish local from sandbox execution.
Sourcefn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads a file’s content as UTF-8 text.
Sourcefn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 Path,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Writes content to path (creating or truncating the file).
Sourcefn run_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cwd: &'life1 Path,
argv: &'life2 [String],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cwd: &'life1 Path,
argv: &'life2 [String],
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Runs a command with working directory cwd, argument vector argv and a
wall-clock timeout; returns the captured output.
Sourcefn list_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists directory entries at path, returning entry names.
Sourcefn grep<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn grep<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pattern: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Searches for regex pattern under path, returning matching lines.
Sourcefn find<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
glob: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn find<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
glob: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Finds files matching glob under path, returning matching paths.
Sourcefn git<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn git<'life0, 'life1, 'async_trait>(
&'life0 self,
args: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Runs a git invocation with args in the repository context of the executor.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".