testcontainer/port

Types

A container port together with its protocol. Build with tcp/1 / udp/1 (panic-free, but trust the caller to pass a valid number) or try_tcp/1 / try_udp/1 (validated Result).

pub opaque type Port

Values

pub fn number(port: Port) -> Int

Returns the port number.

pub fn protocol(port: Port) -> String

Returns "tcp" or "udp".

pub fn tcp(number: Int) -> Port

Creates a TCP port. Numbers outside 1..=65535 will be rejected later by start/1. For up-front validation, prefer try_tcp/1.

pub fn try_tcp(number: Int) -> Result(Port, error.Error)

Validated TCP port constructor.

pub fn try_udp(number: Int) -> Result(Port, error.Error)

Validated UDP port constructor.

pub fn udp(number: Int) -> Port

Creates a UDP port. See tcp/1 for validation notes.

Search Document