use-docker-port 0.0.1

Primitive Docker port mapping parsing for RustUse
Documentation
  • Coverage
  • 100%
    20 out of 20 items documented1 out of 13 items with examples
  • Size
  • Source code size: 9.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 606.6 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-docker
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-docker-port

Primitive Docker port mapping parsing for RustUse.

This crate parses common port mapping strings such as 8080:80, 127.0.0.1:8080:80, 80/tcp, and 53/udp.

Basic Usage

use use_docker_port::{PortMapping, PortProtocol};

let mapping: PortMapping = "127.0.0.1:8080:80/tcp".parse()?;

assert_eq!(mapping.host_ip(), Some("127.0.0.1"));
assert_eq!(mapping.host_port().map(|port| port.get()), Some(8080));
assert_eq!(mapping.container_port().get(), 80);
assert_eq!(mapping.protocol(), PortProtocol::Tcp);
# Ok::<(), Box<dyn std::error::Error>>(())