Struct docker_compose::v2::PortMapping
[−]
[src]
pub struct PortMapping { pub host_address: Option<IpAddr>, pub host_ports: Option<Ports>, pub container_ports: Ports, // some fields omitted }
Specify how to map container ports to the host.
Fields
host_address: Option<IpAddr>
An optional host address on which to listen. Defaults to all host
addresses. If this field is specified, then host_ports
must also
be specified.
host_ports: Option<Ports>
The host port(s) on which to listen. Must contain the same number
of ports as container_ports
. Defaults to an
automatically-assigned port number.
container_ports: Ports
The container port(s) to export.
Methods
impl PortMapping
[src]
fn new<P1, P2>(host_ports: P1, container_ports: P2) -> PortMapping where P1: Into<Ports>, P2: Into<Ports>
Map a specified host port to a container port. Can also be used to map port ranges.
use docker_compose::v2 as dc; let mapping = dc::PortMapping::new(80, 3000); assert_eq!(mapping.host_address, None); assert_eq!(mapping.host_ports, Some(dc::Ports::Port(80))); assert_eq!(mapping.container_ports, dc::Ports::Port(3000)); dc::PortMapping::new(dc::Ports::Range(8080, 8089), dc::Ports::Range(3000, 3009));Run
fn any_to<P>(container_ports: P) -> PortMapping where P: Into<Ports>
Allocate a host port and map it to the specified container port. Can also be used with a port range.
use docker_compose::v2 as dc; let mapping = dc::PortMapping::any_to(3000); assert_eq!(mapping.host_address, None); assert_eq!(mapping.host_ports, None); assert_eq!(mapping.container_ports, dc::Ports::Port(3000));Run
Trait Implementations
impl Eq for PortMapping
[src]
impl PartialEq for PortMapping
[src]
fn eq(&self, __arg_0: &PortMapping) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &PortMapping) -> bool
This method tests for !=
.
impl Clone for PortMapping
[src]
fn clone(&self) -> PortMapping
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more