pub trait Client: Clone {
type ClientType: Client;
// Required methods
fn command(&self) -> Command;
fn create<C>(&self, container: C) -> ContainerHandle<Self::ClientType>
where C: IntoContainer;
fn run(&self, container: &Container) -> Result<(), ContainersError>;
fn stop(&self, container: &Container) -> Result<(), ContainersError>;
fn rm(&self, container: &Container) -> Result<(), ContainersError>;
fn log(&self, container: &Container) -> Result<Option<Log>, ContainersError>;
fn inspect(
&self,
container: &Container,
) -> Result<Option<DetailedContainerInfo>, ContainersError>;
fn exists(&self, container: &Container) -> Result<bool, ContainersError>;
fn runs(&self, container: &Container) -> Result<bool, ContainersError>;
fn wait(&self, container: &Container) -> Result<(), ContainersError>;
}Expand description
The client Trait represents a way to access a client.
It’s implemented by the crate::client::podman::Podman struct for example. And will be for docker as well.
If you do that for any specific Type you get handles for free.
Required Associated Types§
type ClientType: Client
Required Methods§
fn command(&self) -> Command
fn create<C>(&self, container: C) -> ContainerHandle<Self::ClientType>where
C: IntoContainer,
fn run(&self, container: &Container) -> Result<(), ContainersError>
fn stop(&self, container: &Container) -> Result<(), ContainersError>
fn rm(&self, container: &Container) -> Result<(), ContainersError>
fn log(&self, container: &Container) -> Result<Option<Log>, ContainersError>
fn inspect( &self, container: &Container, ) -> Result<Option<DetailedContainerInfo>, ContainersError>
fn exists(&self, container: &Container) -> Result<bool, ContainersError>
fn runs(&self, container: &Container) -> Result<bool, ContainersError>
fn wait(&self, container: &Container) -> Result<(), ContainersError>
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.