MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_ipv6_addr_str

Function get_ipv6_addr_str

crates/stdlib/src/socket.rs:3366–3374  ·  view source on GitHub ↗
(ipv6: Ipv6Addr)

Source from the content-addressed store, hash-verified

3364 }
3365
3366 fn get_ipv6_addr_str(ipv6: Ipv6Addr) -> String {
3367 match ipv6.to_ipv4() {
3368 // instead of "::0.0.ddd.ddd" it's "::xxxx"
3369 Some(v4) if !ipv6.is_unspecified() && matches!(v4.octets(), [0, 0, _, _]) => {
3370 format!("::{:x}", u32::from(v4))
3371 }
3372 _ => ipv6.to_string(),
3373 }
3374 }
3375
3376 pub(crate) struct Deadline {
3377 deadline: Instant,

Callers 1

inet_ntopFunction · 0.85

Calls 2

to_stringMethod · 0.80
is_unspecifiedMethod · 0.45

Tested by

no test coverage detected