pub struct ContainerConfig<'l> { /* private fields */ }Expand description
Create a new instance of the ContainerConfig struct with the given parameters.
Examples
Creating a new configuration using the derived builder:
use docker_utils::*;
let config = ContainerConfig::builder()
.name("test_container")
.image("test_image")
.tag("latest")
.url("0.0.0.0")
.connection_port(8080)
.reuse_container(true)
.keep_configuration(true)
.wait_strategy(WaitStrategy::NoWait)
.build();Implementations§
Source§impl<'l> ContainerConfig<'l>
impl<'l> ContainerConfig<'l>
Sourcepub fn builder() -> ContainerConfigBuilder<'l>
pub fn builder() -> ContainerConfigBuilder<'l>
Create an instance of ContainerConfig using the builder syntax
Source§impl<'l> ContainerConfig<'l>
impl<'l> ContainerConfig<'l>
Sourcepub const fn new(
name: &'l str,
image: &'l str,
tag: &'l str,
url: &'l str,
connection_port: u16,
additional_ports: Option<&'l [u16]>,
additional_env_vars: Option<&'l [&'l str]>,
platform: Option<&'l str>,
reuse_container: bool,
keep_configuration: bool,
wait_strategy: WaitStrategy,
) -> Self
pub const fn new( name: &'l str, image: &'l str, tag: &'l str, url: &'l str, connection_port: u16, additional_ports: Option<&'l [u16]>, additional_env_vars: Option<&'l [&'l str]>, platform: Option<&'l str>, reuse_container: bool, keep_configuration: bool, wait_strategy: WaitStrategy, ) -> Self
Create a new instance of the ContainerConfig struct with the given parameters.
§Arguments
name- The name of the container.image- The image to use for the container.tag- The tag of the image.url- The default URL of the container. Usually 0.0.0.0connection_port- The port number for the main connection i.e. 80 for a webserver.additional_ports- An optional array of additional ports to publish.platform- An optional platform string in case the container image is not multi-arch.reuse_container- A boolean flag indicating whether to reuse an existing container if found.keep_configuration- A boolean flag indication whether to keep the configuration upon every environment setup. If set to true, the same configuration will be used across all environment setups. If false, each setup will re-create all tables and import data.,wait_strategy- The wait strategy to use for the container.
Examples
Creating a new configuration using the constructor:
use docker_utils::*;
let config = ContainerConfig::new(
"test_container",
"test_image",
"latest",
"0.0.0.0",
8080,
Some(&[8081, 8082]),
Some(&["ENV_VAR=VALUE", "DEBUG=true"]),
Some("linux/amd64"),
true,
false,
WaitStrategy::default(), // NoWait is the default wait strategy
);§Returns
Returns a new instance of the ContainerConfig struct.
Source§impl<'l> ContainerConfig<'l>
impl<'l> ContainerConfig<'l>
pub const fn name(&self) -> &'l str
pub fn container_image(&self) -> String
pub fn container_name(&self) -> String
pub const fn url(&self) -> &'l str
pub const fn connection_port(&self) -> u16
pub const fn additional_ports(&self) -> Option<&'l [u16]>
pub const fn additional_env_vars(&self) -> Option<&'l [&'l str]>
pub const fn platform(&self) -> Option<&'l str>
pub const fn reuse_container(&self) -> bool
pub const fn keep_configuration(&self) -> bool
pub const fn wait_strategy(&self) -> &WaitStrategy
pub const fn image(&self) -> &'l str
pub const fn tag(&self) -> &'l str
Trait Implementations§
Source§impl<'l> Clone for ContainerConfig<'l>
impl<'l> Clone for ContainerConfig<'l>
Source§fn clone(&self) -> ContainerConfig<'l>
fn clone(&self) -> ContainerConfig<'l>
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<'l> Debug for ContainerConfig<'l>
impl<'l> Debug for ContainerConfig<'l>
Source§impl<'l> Default for ContainerConfig<'l>
impl<'l> Default for ContainerConfig<'l>
Source§fn default() -> ContainerConfig<'l>
fn default() -> ContainerConfig<'l>
Returns the “default value” for a type. Read more
Source§impl Display for ContainerConfig<'_>
impl Display for ContainerConfig<'_>
Source§impl<'l> Hash for ContainerConfig<'l>
impl<'l> Hash for ContainerConfig<'l>
Source§impl<'l> Ord for ContainerConfig<'l>
impl<'l> Ord for ContainerConfig<'l>
Source§fn cmp(&self, other: &ContainerConfig<'l>) -> Ordering
fn cmp(&self, other: &ContainerConfig<'l>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'l> PartialEq for ContainerConfig<'l>
impl<'l> PartialEq for ContainerConfig<'l>
Source§impl<'l> PartialOrd for ContainerConfig<'l>
impl<'l> PartialOrd for ContainerConfig<'l>
impl<'l> Eq for ContainerConfig<'l>
impl<'l> StructuralPartialEq for ContainerConfig<'l>
Auto Trait Implementations§
impl<'l> Freeze for ContainerConfig<'l>
impl<'l> RefUnwindSafe for ContainerConfig<'l>
impl<'l> Send for ContainerConfig<'l>
impl<'l> Sync for ContainerConfig<'l>
impl<'l> Unpin for ContainerConfig<'l>
impl<'l> UnwindSafe for ContainerConfig<'l>
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request