pub struct RenameCommand {
pub executor: CommandExecutor,
/* private fields */
}
Expand description
Docker rename command builder
Rename a container.
§Example
use docker_wrapper::RenameCommand;
// Rename a container
let result = RenameCommand::new("old-name", "new-name")
.run()
.await?;
if result.success() {
println!("Container renamed successfully");
}
Fields§
§executor: CommandExecutor
Command executor
Implementations§
Source§impl RenameCommand
impl RenameCommand
Sourcepub fn new(old_name: impl Into<String>, new_name: impl Into<String>) -> Self
pub fn new(old_name: impl Into<String>, new_name: impl Into<String>) -> Self
Create a new rename command
§Example
use docker_wrapper::RenameCommand;
let cmd = RenameCommand::new("old-container", "new-container");
Sourcepub async fn run(&self) -> Result<RenameResult>
pub async fn run(&self) -> Result<RenameResult>
Execute the rename command
§Errors
Returns an error if:
- The Docker daemon is not running
- The container doesn’t exist
- The new name is already in use
- The container is running (some Docker versions)
§Example
use docker_wrapper::RenameCommand;
let result = RenameCommand::new("web-server", "api-server")
.run()
.await?;
if result.success() {
println!("Container renamed from '{}' to '{}'",
result.old_name(), result.new_name());
}
Trait Implementations§
Source§impl Clone for RenameCommand
impl Clone for RenameCommand
Source§fn clone(&self) -> RenameCommand
fn clone(&self) -> RenameCommand
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 RenameCommand
impl Debug for RenameCommand
Source§impl DockerCommand for RenameCommand
impl DockerCommand for RenameCommand
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 RenameCommand
impl RefUnwindSafe for RenameCommand
impl Send for RenameCommand
impl Sync for RenameCommand
impl Unpin for RenameCommand
impl UnwindSafe for RenameCommand
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