pub struct Container<F, E>{ /* private fields */ }Expand description
Represents a podman container.
This struct abstracts starting, stopping, and removing the container.
The generic callback F allows running custom logic after the container is first created.
Implementations§
Source§impl<F, E> Container<F, E>
impl<F, E> Container<F, E>
Sourcepub fn new<N, I, A>(name: N, image: I, args: Vec<A>, callback: F) -> Self
pub fn new<N, I, A>(name: N, image: I, args: Vec<A>, callback: F) -> Self
Creates a new container instance.
§Arguments
name- The name of the container.image- The container image to use.args- Additional arguments to pass to thepodman runcommand.callback- A callback function executed after the container starts.
Sourcepub fn start(&self) -> Result<(), ContainerError<E>>
pub fn start(&self) -> Result<(), ContainerError<E>>
Starts the container.
- If the container is already running, this is a no-op.
- If the container is stopped, paused, or exited, it will be started.
- If the container does not exist, it will be created and started, and the callback function will be run.
Auto Trait Implementations§
impl<F, E> Freeze for Container<F, E>where
F: Freeze,
impl<F, E> RefUnwindSafe for Container<F, E>where
F: RefUnwindSafe,
impl<F, E> Send for Container<F, E>where
F: Send,
impl<F, E> Sync for Container<F, E>where
F: Sync,
impl<F, E> Unpin for Container<F, E>where
F: Unpin,
impl<F, E> UnwindSafe for Container<F, E>where
F: UnwindSafe,
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