Skip to content

Commit 1073c7c

Browse files
committed
feat: allow passing u16 to Ports
1 parent e2f3950 commit 1073c7c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

testcontainers/src/core/ports.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ impl Ports {
6767
}
6868

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

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

0 commit comments

Comments
 (0)