pub trait Client: Clone {
type ClientType: Client;
// Required methods
fn command(&self) -> Command;
fn create<C: IntoContainer>(
&self,
container: C,
) -> ContainerHandle<Self::ClientType>;
fn run(&self, container: &Container) -> ContainerResult<()>;
fn stop(&self, container: &Container) -> ContainerResult<()>;
fn rm(&self, container: &Container) -> ContainerResult<()>;
fn log(&self, container: &Container) -> ContainerResult<Option<Log>>;
fn inspect(
&self,
container: &Container,
) -> ContainerResult<Option<DetailedContainerInfo>>;
fn exists(&self, container: &Container) -> ContainerResult<bool>;
fn runs(&self, container: &Container) -> ContainerResult<bool>;
fn wait(&self, container: &Container) -> ContainerResult<()>;
}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: IntoContainer>( &self, container: C, ) -> ContainerHandle<Self::ClientType>
fn run(&self, container: &Container) -> ContainerResult<()>
fn stop(&self, container: &Container) -> ContainerResult<()>
fn rm(&self, container: &Container) -> ContainerResult<()>
fn log(&self, container: &Container) -> ContainerResult<Option<Log>>
fn inspect( &self, container: &Container, ) -> ContainerResult<Option<DetailedContainerInfo>>
fn exists(&self, container: &Container) -> ContainerResult<bool>
fn runs(&self, container: &Container) -> ContainerResult<bool>
fn wait(&self, container: &Container) -> ContainerResult<()>
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.