Use Display trait for printing

This commit is contained in:
Keenan Tims 2023-03-19 12:20:56 -07:00
parent 5190e83bb3
commit 498c509e70
Signed by: ktims
GPG Key ID: 11230674D69038D4
2 changed files with 12 additions and 3 deletions

View File

@ -38,6 +38,17 @@ impl IpBothRange {
} }
} }
impl Display for IpBothRange {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for ip in self {
ip.fmt(f)?;
writeln!(f)?;
}
Ok(())
}
}
pub struct IpBothRangeIter<'a> { pub struct IpBothRangeIter<'a> {
v4_iter: IpRangeIter<'a, Ipv4Net>, v4_iter: IpRangeIter<'a, Ipv4Net>,
v6_iter: IpRangeIter<'a, Ipv6Net>, v6_iter: IpRangeIter<'a, Ipv6Net>,

View File

@ -117,9 +117,7 @@ impl App {
self.simplify_inputs(); self.simplify_inputs();
for net in &self.prefixes { print!("{}", self.prefixes);
println!("{}", net);
}
} }
} }