mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
Alter Display
for Ipv6Addr
for IPv4-compatible addresses
This commit is contained in:
parent
6330daade9
commit
3a9a8d4abf
@ -1770,14 +1770,8 @@ impl fmt::Display for Ipv6Addr {
|
||||
f.write_str("::")
|
||||
} else if self.is_loopback() {
|
||||
f.write_str("::1")
|
||||
} else if let Some(ipv4) = self.to_ipv4() {
|
||||
match segments[5] {
|
||||
// IPv4 Compatible address
|
||||
0 => write!(f, "::{}", ipv4),
|
||||
// IPv4 Mapped address
|
||||
0xffff => write!(f, "::ffff:{}", ipv4),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
} else if let Some(ipv4) = self.to_ipv4_mapped() {
|
||||
write!(f, "::ffff:{}", ipv4)
|
||||
} else {
|
||||
#[derive(Copy, Clone, Default)]
|
||||
struct Span {
|
||||
|
Loading…
Reference in New Issue
Block a user