pub trait ClaudeCommand: Send + Sync {
type Output: Send;
// Required methods
fn args(&self) -> Vec<String>;
fn execute(
&self,
claude: &Claude,
) -> impl Future<Output = Result<Self::Output>> + Send;
}Expand description
Trait implemented by all claude CLI command builders.
Each command defines its own Output type and builds its argument
list via args(). Execution is dispatched through the shared Claude
client which provides binary path, environment, and timeout config.
The async execute method is only present when the async feature
is enabled. In sync-only builds, callers reach the blocking path
via ClaudeCommandSyncExt::execute_sync.
Required Associated Types§
Required Methods§
Sourcefn execute(
&self,
claude: &Claude,
) -> impl Future<Output = Result<Self::Output>> + Send
fn execute( &self, claude: &Claude, ) -> impl Future<Output = Result<Self::Output>> + Send
Execute the command using the given claude client.
Dropping the returned future mid-flight kills the spawned CLI
process and, on Unix, its whole process group (SIGKILL): a
caller that races execute against cancellation (e.g.
tokio::select!) does not leave an abandoned run executing in
the background, and subprocesses the CLI spawned for tool use
die with it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".