std-type
Ipv6Addr: 128-bit address
Eight 16-bit segments represent an IPv6 address. Compressed text is a display representation, not a different underlying address. Expected stdout (not executed): true 1 Common mistake: Comparing textual spellings rather than parsed address values.
Formal Syntax & Structure
rust syntaxrust
Ipv6Addr::new(a,b,c,d,e,f,g,h)Working Example
Example Snippetrust
fn main() { use std::net::Ipv6Addr; let a: Ipv6Addr = "2001:db8::1".parse().unwrap(); let b = Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1); println!("{} {}", a == b, a.segments()[7]);}