pub struct InspectCommand {
pub executor: CommandExecutor,
/* private fields */
}
Expand description
Docker inspect command builder
§Example
use docker_wrapper::InspectCommand;
// Inspect a container
let info = InspectCommand::new("my-container")
.run()
.await?;
// Parse as JSON
let json = info.json()?;
println!("Container state: {}", json[0]["State"]["Status"]);
Fields§
§executor: CommandExecutor
Command executor
Implementations§
Source§impl InspectCommand
impl InspectCommand
Sourcepub fn new(object: impl Into<String>) -> Self
pub fn new(object: impl Into<String>) -> Self
Create a new inspect command for a single object
§Example
use docker_wrapper::InspectCommand;
let cmd = InspectCommand::new("my-container");
Sourcepub fn new_multiple(objects: Vec<impl Into<String>>) -> Self
pub fn new_multiple(objects: Vec<impl Into<String>>) -> Self
Create a new inspect command for multiple objects
§Example
use docker_wrapper::InspectCommand;
let cmd = InspectCommand::new_multiple(vec!["container1", "container2"]);
Sourcepub fn format(self, format: impl Into<String>) -> Self
pub fn format(self, format: impl Into<String>) -> Self
Set custom format string (Go template)
§Example
use docker_wrapper::InspectCommand;
let cmd = InspectCommand::new("my-container")
.format("{{.State.Status}}");
Sourcepub fn object_type(self, typ: impl Into<String>) -> Self
pub fn object_type(self, typ: impl Into<String>) -> Self
Specify the type of object to inspect
Valid types: container, image, volume, network, plugin, node, service, etc.
Sourcepub async fn run(&self) -> Result<InspectOutput>
pub async fn run(&self) -> Result<InspectOutput>
Execute the inspect command
§Errors
Returns an error if:
- The Docker daemon is not running
- The specified object doesn’t exist
- The object type is invalid
Sourcepub fn get_executor(&self) -> &CommandExecutor
pub fn get_executor(&self) -> &CommandExecutor
Gets the command executor
Sourcepub fn get_executor_mut(&mut self) -> &mut CommandExecutor
pub fn get_executor_mut(&mut self) -> &mut CommandExecutor
Gets the command executor mutably
Sourcepub fn build_command_args(&self) -> Vec<String>
pub fn build_command_args(&self) -> Vec<String>
Builds the command arguments for Docker inspect
Trait Implementations§
Source§impl Clone for InspectCommand
impl Clone for InspectCommand
Source§fn clone(&self) -> InspectCommand
fn clone(&self) -> InspectCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for InspectCommand
impl Debug for InspectCommand
Source§impl DockerCommand for InspectCommand
impl DockerCommand for InspectCommand
Source§type Output = CommandOutput
type Output = CommandOutput
The output type this command produces
Source§fn get_executor(&self) -> &CommandExecutor
fn get_executor(&self) -> &CommandExecutor
Get the command executor for extensibility
Source§fn get_executor_mut(&mut self) -> &mut CommandExecutor
fn get_executor_mut(&mut self) -> &mut CommandExecutor
Get mutable command executor for extensibility
Source§fn build_command_args(&self) -> Vec<String>
fn build_command_args(&self) -> Vec<String>
Build the complete command arguments including subcommands
Source§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,
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,
Execute the command and return the typed output
Source§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 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
Source§fn 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)
Auto Trait Implementations§
impl Freeze for InspectCommand
impl RefUnwindSafe for InspectCommand
impl Send for InspectCommand
impl Sync for InspectCommand
impl Unpin for InspectCommand
impl UnwindSafe for InspectCommand
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