use compose_yml::v2 as dc;
pub trait PortMappingExt {
fn host_string(&self) -> Option<String>;
}
impl PortMappingExt for dc::PortMapping {
fn host_string(&self) -> Option<String> {
match (self.host_address, self.host_ports) {
(Some(ref addr), Some(ref ports)) => Some(format!("{}:{}", addr, ports)),
(None, Some(ref ports)) => Some(format!("{}", ports)),
_ => None,
}
}
}