pub trait DockerCommand {
type Output;
// Required methods
fn get_executor(&self) -> &CommandExecutor;
fn get_executor_mut(&mut self) -> &mut CommandExecutor;
fn build_command_args(&self) -> Vec<String>;
fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self { ... }
fn args<I, S>(&mut self, args: I) -> &mut Self
where I: IntoIterator<Item = S>,
S: AsRef<OsStr> { ... }
fn flag(&mut self, flag: &str) -> &mut Self { ... }
fn option(&mut self, key: &str, value: &str) -> &mut Self { ... }
fn with_timeout(&mut self, timeout: Duration) -> &mut Self { ... }
fn with_timeout_secs(&mut self, seconds: u64) -> &mut Self { ... }
}Expand description
Unified trait for all Docker commands (both regular and compose)
Required Associated Types§
Required Methods§
Sourcefn get_executor(&self) -> &CommandExecutor
fn get_executor(&self) -> &CommandExecutor
Get the command executor for extensibility
Sourcefn get_executor_mut(&mut self) -> &mut CommandExecutor
fn get_executor_mut(&mut self) -> &mut CommandExecutor
Get mutable command executor for extensibility
Sourcefn build_command_args(&self) -> Vec<String>
fn build_command_args(&self) -> Vec<String>
Build the complete command arguments including subcommands
Provided Methods§
Sourcefn execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Helper method to execute the command with proper error handling
Sourcefn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
Add a raw argument to the command (escape hatch)
Sourcefn args<I, S>(&mut self, args: I) -> &mut Self
fn args<I, S>(&mut self, args: I) -> &mut Self
Add multiple raw arguments to the command (escape hatch)
Sourcefn option(&mut self, key: &str, value: &str) -> &mut Self
fn option(&mut self, key: &str, value: &str) -> &mut Self
Add a key-value option (e.g., –name value, –env key=value)
Sourcefn with_timeout(&mut self, timeout: Duration) -> &mut Self
fn with_timeout(&mut self, timeout: Duration) -> &mut Self
Set a timeout for command execution
If the command takes longer than the specified duration, it will be
terminated and an Error::Timeout will be returned.
Sourcefn with_timeout_secs(&mut self, seconds: u64) -> &mut Self
fn with_timeout_secs(&mut self, seconds: u64) -> &mut Self
Set a timeout in seconds for command execution
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.