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

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.

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.

The container port(s) to export.

Methods

impl PortMapping
[src]

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

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]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for PortMapping
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for PortMapping
[src]

Formats the value using the given formatter.

impl Display for PortMapping
[src]

Formats the value using the given formatter.

impl FromStr for PortMapping
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more