Manually implement Display, uglier debug

This commit is contained in:
Linus Färnstrand
2016-06-20 15:55:35 +02:00
parent b5b0856a04
commit 31d890735d

View File

@ -18,13 +18,13 @@ pub enum IpNetwork {
V6(Ipv6Network), V6(Ipv6Network),
} }
#[derive(Clone,Copy,Hash,PartialEq,Eq)] #[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)]
pub struct Ipv4Network { pub struct Ipv4Network {
addr: Ipv4Addr, addr: Ipv4Addr,
prefix: u8, prefix: u8,
} }
#[derive(Clone,Copy,Hash,PartialEq,Eq)] #[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)]
pub struct Ipv6Network { pub struct Ipv6Network {
addr: Ipv6Addr, addr: Ipv6Addr,
prefix: u8, prefix: u8,
@ -205,13 +205,13 @@ impl IpNetwork {
} }
} }
impl fmt::Debug for Ipv4Network { impl fmt::Display for Ipv4Network {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}/{}", self.ip(), self.prefix()) write!(fmt, "{}/{}", self.ip(), self.prefix())
} }
} }
impl fmt::Debug for Ipv6Network { impl fmt::Display for Ipv6Network {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}/{}", self.ip(), self.prefix()) write!(fmt, "{}/{}", self.ip(), self.prefix())
} }