Skip to content

Commit

Permalink
feat: allow passing u16 to Ports
Browse files Browse the repository at this point in the history
  • Loading branch information
DDtKey committed Jun 15, 2024
1 parent e2f3950 commit 1073c7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions testcontainers/src/core/ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ impl Ports {
}

/// Returns the host port for the given internal container's port, on the host's IPv4 interfaces.
pub fn map_to_host_port_ipv4(&self, container_port: ContainerPort) -> Option<u16> {
self.ipv4_mapping.get(&container_port).cloned()
pub fn map_to_host_port_ipv4(&self, container_port: impl Into<ContainerPort>) -> Option<u16> {
self.ipv4_mapping.get(&container_port.into()).cloned()
}

/// Returns the host port for the given internal container's port, on the host's IPv6 interfaces.
pub fn map_to_host_port_ipv6(&self, container_port: ContainerPort) -> Option<u16> {
self.ipv6_mapping.get(&container_port).cloned()
pub fn map_to_host_port_ipv6(&self, container_port: impl Into<ContainerPort>) -> Option<u16> {
self.ipv6_mapping.get(&container_port.into()).cloned()
}
}

Expand Down

0 comments on commit 1073c7c

Please sign in to comment.