Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    // Required methods
    fn inspect(&self, container: &str) -> Result<bool, ExecError>;
    fn exec(&self, container: &str, args: &[&str]) -> Result<String, ExecError>;
    fn copy_to_container(
        &self,
        container: &str,
        host_path: &str,
        container_path: &str,
    ) -> Result<(), ExecError>;
}
Expand description

Ported from the Backend interface in interface.go.

Required Methods§

Source

fn inspect(&self, container: &str) -> Result<bool, ExecError>

Reports whether the named container exists. A missing container returns Ok(false); only true execution errors yield Err.

Source

fn exec(&self, container: &str, args: &[&str]) -> Result<String, ExecError>

Runs docker exec <container> <args...> and returns the captured stdout.

Source

fn copy_to_container( &self, container: &str, host_path: &str, container_path: &str, ) -> Result<(), ExecError>

Copies a single host file to the given path inside the container via docker cp.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§