I am trying understand how Ipv6 formatting works in rust. I have the following code -
fn main() {
let ipv6_1 = Ipv6Addr::from_str("2001:db8:abcd:1781::78c").unwrap();
println!("ipv6_1 - {}", ipv6_1);
let ipv6_2 = Ipv6Addr::from_str("::a0a:5b0b").unwrap();
println!("ipv6_2 - {}", ipv6_2);
}
Output:
ipv6_1 - 2001:db8:abcd:1781::78c
ipv6_2 - ::10.10.91.11
In both cases I was expecting output to match the input string format, but it does not appear to be the case for the second input. Any suggestions on how I can get the output to match in the second case as well (i.e. ipv6_2)?
I am trying to match the ipv6 input string format with the Ipv6Addr Display format. I am expecting both to be the same.