Configurator

Struct Configurator 

Source
pub struct Configurator { /* private fields */ }
Expand description

Configuration of the container

Implementations§

Source§

impl Configurator

Source

pub fn create(self) -> Container

Create the container

Source

pub fn set_command( self, command: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Set the command for the docker

Source

pub fn set_capture_stdio(self, capture: bool) -> Self

Capture stdin/err/out

Source

pub fn set_interactive(self, interactive: bool) -> Self

Set the docker in interactive mode.

Source

pub fn set_tty(self, tty: bool) -> Self

Set the docker in TTY mode.

Source

pub fn set_privilged(self, privileged: bool) -> Self

👎Deprecated since 0.2.4: please use set_privileged instead

Enable/disable privileged (see docker documentation).

Source

pub fn set_privileged(self, privileged: bool) -> Self

Enable/disable privileged (see docker documentation).

Source

pub fn set_x11_forwarding(self, x11_forwarding: bool) -> Self

Forward X11 to the container

Source

pub fn set_network(self, network: Network) -> Self

Set the network mode

Source

pub fn set_ipc(self, ipc: Ipc, size: Option<&str>) -> Self

Set the IPC mode. Size is optional, for instance “1g”

Source

pub fn mount( self, host_dir: impl Into<String>, container_dir: impl Into<String>, ) -> Self

Mount a drive from the host to the container

Source

pub fn set_username(self, username: impl Into<String>) -> Self

Set the username in the container, this is required for X11 forwarding

Source

pub fn set_env_variable( self, key: impl Into<String>, variable: impl Into<String>, ) -> Self

Set an environment variable

Source

pub fn copy_env_variable_from_host(self, key: impl Into<String>) -> Self

Copy a variable from host environment. Silently fails if the variable is not available in host.

Source

pub fn set_clean_up(self, clean_up: bool) -> Self

Set if the container should be cleaned up after execution (set –rm)

Source

pub fn set_name(self, name: impl Into<String>) -> Self

set the name of the container

Source

pub fn generate_name(self, prefix: impl Into<String>) -> Self

generate a name with the given prefix

Source

pub fn map_port(self, host_port: u16, container_port: u16) -> Self

Map a host port to a container port

Source

pub fn work_directory(self, working_directory: impl Into<String>) -> Self

Set the work directory in the container

Source

pub fn with_ok<T, E>( self, value: Result<T, E>, f: impl FnOnce(Self, T) -> Self, ) -> Self

Convenience function for configuring the container with a value that comes from a result.

Source

pub fn with_some<T>( self, value: Option<T>, f: impl FnOnce(Self, T) -> Self, ) -> Self

Convenience function for configuring the container with a value that comes from an option.

Source

pub fn cond(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self

Convenience function for configuring the container with a condition. If cond is true, the closure f is executed.

Source

pub fn cond_or( self, cond: bool, f: impl FnOnce(Self) -> Self, g: impl FnOnce(Self) -> Self, ) -> Self

Convenience function for configuring the container with cond. If cond is true, the closure f is executed, otherwise g is executed.

Source

pub fn unwrap_option<T>( self, value: &Option<T>, f: impl FnOnce(Self, &T) -> Self, ) -> Self

If the option is set call the function f. Otherwise do nothing and return self.

Source

pub fn unwrap_option_or<T>( self, value: &Option<T>, f: impl FnOnce(Self, &T) -> Self, g: impl FnOnce(Self) -> Self, ) -> Self

If the option is set call the function f. Otherwise do nothing and return self.

Source

pub fn pull(&self) -> Result<()>

Pull the image.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V