mirror of
https://github.com/achanda/ipnetwork.git
synced 2025-06-17 17:28:51 +00:00
Manually implement Display, uglier debug
This commit is contained in:
@ -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())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user