pub struct Definition { /* private fields */ }Implementations§
Source§impl Definition
impl Definition
pub fn new(backend: Backend, reference: Reference) -> Definition
Sourcepub fn with_container<F, R>(&self, f: F) -> R
pub fn with_container<F, R>(&self, f: F) -> R
Runs a detached container and passes it to the provided closure.
The container is automatically stopped when dropped (after the closure returns or on panic).
pub fn backend(self, backend: Backend) -> Self
pub fn entrypoint(self, command: impl Into<Entrypoint>) -> Self
pub fn workdir(self, path: impl Into<Workdir>) -> Self
pub fn arguments( self, arguments: impl IntoIterator<Item = impl Into<ContainerArgument>>, ) -> Self
pub fn argument(self, argument: impl Into<ContainerArgument>) -> Self
pub fn environment_variable(self, key: &str, value: &str) -> Self
pub fn environment_variables<K: ToString, V: ToString>( self, values: impl IntoIterator<Item = (K, V)>, ) -> Self
pub fn remove(self) -> Self
pub fn no_remove(self) -> Self
Sourcepub fn stop_on_drop(self) -> Self
pub fn stop_on_drop(self) -> Self
Marks the container to be stopped when the Container handle is dropped.
By default containers are not stopped on drop. Use this when you want automatic cleanup of running containers when the handle goes out of scope.
Sourcepub fn remove_on_drop(self) -> Self
pub fn remove_on_drop(self) -> Self
Marks the container for removal when the Container handle is dropped.
This is different from remove() which uses --rm flag:
remove()→ docker/podman removes container when it stops (can’t commit)remove_on_drop()→ Rust removes container on Drop (can commit stopped container)
Use this when you need to stop a container, commit it, then clean up.
pub fn detach(self) -> Self
pub fn no_detach(self) -> Self
pub fn publish(self, value: impl Into<Publish>) -> Self
pub fn publishes( self, values: impl IntoIterator<Item = impl Into<Publish>>, ) -> Self
pub fn mount(self, value: impl Into<Mount>) -> Self
pub fn mounts(self, values: impl IntoIterator<Item = impl Into<Mount>>) -> Self
pub fn run_detached(&self) -> Container
pub fn run_capture_only_stdout(&self) -> Vec<u8> ⓘ
Sourcepub fn run(&self) -> Result<(), CommandError>
pub fn run(&self) -> Result<(), CommandError>
Runs the container and returns success or an error.
Trait Implementations§
Source§impl Clone for Definition
impl Clone for Definition
Source§fn clone(&self) -> Definition
fn clone(&self) -> Definition
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 Definition
impl Debug for Definition
Source§impl PartialEq for Definition
impl PartialEq for Definition
impl Eq for Definition
impl StructuralPartialEq for Definition
Auto Trait Implementations§
impl Freeze for Definition
impl RefUnwindSafe for Definition
impl Send for Definition
impl Sync for Definition
impl Unpin for Definition
impl UnwindSafe for Definition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.