Struct compose_yml::v2::PortMapping [] [src]

pub struct PortMapping {
    pub host_address: Option<IpAddr>,
    pub host_ports: Option<Ports>,
    pub container_ports: Ports,
    pub protocol: Protocol,
    // 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.

The protocol to be used on the given port(s).

Methods

impl PortMapping
[src]

[src]

Map a specified host port to a container port. Can also be used to map port ranges.

use compose_yml::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));

[src]

Allocate a host port and map it to the specified container port. Can also be used with a port range.

use compose_yml::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));

Trait Implementations

impl Debug for PortMapping
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for PortMapping
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for PortMapping
[src]

[src]

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

[src]

This method tests for !=.

impl Eq for PortMapping
[src]

impl Display for PortMapping
[src]

[src]

Formats the value using the given formatter. Read more

impl FromStr for PortMapping
[src]

The associated error which can be returned from parsing.

[src]

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

Auto Trait Implementations

impl Send for PortMapping

impl Sync for PortMapping