pub struct Configurator { /* private fields */ }
Expand description
Configuration of the container
Implementations§
Source§impl Configurator
impl Configurator
Sourcepub fn set_command(
self,
command: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn set_command( self, command: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Set the command for the docker
Sourcepub fn set_capture_stdio(self, capture: bool) -> Self
pub fn set_capture_stdio(self, capture: bool) -> Self
Capture stdin/err/out
Sourcepub fn set_interactive(self, interactive: bool) -> Self
pub fn set_interactive(self, interactive: bool) -> Self
Set the docker in interactive mode.
Sourcepub fn set_privilged(self, privileged: bool) -> Self
👎Deprecated since 0.2.4: please use set_privileged
instead
pub fn set_privilged(self, privileged: bool) -> Self
set_privileged
insteadEnable/disable privileged (see docker documentation).
Sourcepub fn set_privileged(self, privileged: bool) -> Self
pub fn set_privileged(self, privileged: bool) -> Self
Enable/disable privileged (see docker documentation).
Sourcepub fn set_x11_forwarding(self, x11_forwarding: bool) -> Self
pub fn set_x11_forwarding(self, x11_forwarding: bool) -> Self
Forward X11 to the container
Sourcepub fn set_network(self, network: Network) -> Self
pub fn set_network(self, network: Network) -> Self
Set the network mode
Sourcepub fn set_ipc(self, ipc: Ipc, size: Option<&str>) -> Self
pub fn set_ipc(self, ipc: Ipc, size: Option<&str>) -> Self
Set the IPC mode. Size is optional, for instance “1g”
Sourcepub fn mount(
self,
host_dir: impl Into<String>,
container_dir: impl Into<String>,
) -> Self
pub fn mount( self, host_dir: impl Into<String>, container_dir: impl Into<String>, ) -> Self
Mount a drive from the host to the container
Sourcepub fn set_username(self, username: impl Into<String>) -> Self
pub fn set_username(self, username: impl Into<String>) -> Self
Set the username in the container, this is required for X11 forwarding
Sourcepub fn set_env_variable(
self,
key: impl Into<String>,
variable: impl Into<String>,
) -> Self
pub fn set_env_variable( self, key: impl Into<String>, variable: impl Into<String>, ) -> Self
Set an environment variable
Sourcepub fn copy_env_variable_from_host(self, key: impl Into<String>) -> Self
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.
Sourcepub fn set_clean_up(self, clean_up: bool) -> Self
pub fn set_clean_up(self, clean_up: bool) -> Self
Set if the container should be cleaned up after execution (set –rm)
Sourcepub fn generate_name(self, prefix: impl Into<String>) -> Self
pub fn generate_name(self, prefix: impl Into<String>) -> Self
generate a name with the given prefix
Sourcepub fn map_port(self, host_port: u16, container_port: u16) -> Self
pub fn map_port(self, host_port: u16, container_port: u16) -> Self
Map a host port to a container port
Sourcepub fn work_directory(self, working_directory: impl Into<String>) -> Self
pub fn work_directory(self, working_directory: impl Into<String>) -> Self
Set the work directory in the container
Sourcepub fn with_ok<T, E>(
self,
value: Result<T, E>,
f: impl FnOnce(Self, T) -> Self,
) -> Self
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.
Sourcepub fn with_some<T>(
self,
value: Option<T>,
f: impl FnOnce(Self, T) -> Self,
) -> Self
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.
Sourcepub fn cond(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self
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.
Sourcepub fn cond_or(
self,
cond: bool,
f: impl FnOnce(Self) -> Self,
g: impl FnOnce(Self) -> Self,
) -> Self
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.
Sourcepub fn unwrap_option<T>(
self,
value: &Option<T>,
f: impl FnOnce(Self, &T) -> Self,
) -> Self
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.