impl Display for PortForwardProtocol

This commit is contained in:
lemonsh 2023-05-14 00:06:28 +02:00
parent b11c20d512
commit 8e9b778f75

View File

@ -1,3 +1,4 @@
use std::fmt::Display;
use std::net::Ipv4Addr;
use std::time::Duration;
@ -93,6 +94,16 @@ impl<'de> Deserialize<'de> for PortForwardProtocol {
}
}
impl Display for PortForwardProtocol {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
PortForwardProtocol::Tcp => "TCP",
PortForwardProtocol::Udp => "UDP",
PortForwardProtocol::Both => "Both",
})
}
}
fn bool_from_int<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
D: Deserializer<'de>,