pub struct ExportCommand {
pub executor: CommandExecutor,
/* private fields */
}
Expand description
Docker export command builder
Export a container’s filesystem as a tar archive.
§Example
use docker_wrapper::ExportCommand;
// Export container to file
let result = ExportCommand::new("my-container")
.output("container.tar")
.run()
.await?;
if result.success() {
println!("Container exported to container.tar");
}
Fields§
§executor: CommandExecutor
Command executor
Implementations§
Source§impl ExportCommand
impl ExportCommand
Sourcepub fn new(container: impl Into<String>) -> Self
pub fn new(container: impl Into<String>) -> Self
Create a new export command
§Example
use docker_wrapper::ExportCommand;
let cmd = ExportCommand::new("my-container");
Sourcepub fn output(self, output: impl Into<String>) -> Self
pub fn output(self, output: impl Into<String>) -> Self
Set output file for the export
§Example
use docker_wrapper::ExportCommand;
let cmd = ExportCommand::new("my-container")
.output("backup.tar");
Sourcepub async fn run(&self) -> Result<ExportResult>
pub async fn run(&self) -> Result<ExportResult>
Execute the export command
§Errors
Returns an error if:
- The Docker daemon is not running
- The container doesn’t exist
- File I/O errors occur during export
- Insufficient disk space
§Example
use docker_wrapper::ExportCommand;
let result = ExportCommand::new("web-server")
.output("web-backup.tar")
.run()
.await?;
if result.success() {
println!("Container '{}' exported to '{}'",
result.container(), result.output_file().unwrap_or("stdout"));
}
Trait Implementations§
Source§impl Clone for ExportCommand
impl Clone for ExportCommand
Source§fn clone(&self) -> ExportCommand
fn clone(&self) -> ExportCommand
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 ExportCommand
impl Debug for ExportCommand
Source§impl DockerCommand for ExportCommand
impl DockerCommand for ExportCommand
Source§type Output = CommandOutput
type Output = CommandOutput
The output type this command produces
Source§fn build_command_args(&self) -> Vec<String>
fn build_command_args(&self) -> Vec<String>
Build the complete command arguments including subcommands
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 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 ExportCommand
impl RefUnwindSafe for ExportCommand
impl Send for ExportCommand
impl Sync for ExportCommand
impl Unpin for ExportCommand
impl UnwindSafe for ExportCommand
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