format_ipv6

Function format_ipv6 

Source
pub fn format_ipv6(bytes: &[u8]) -> Option<String>
Expand description

Format 16 bytes as an IPv6 address string.

Returns None if the slice is not exactly 16 bytes.

ยงExample

use pcapsql_core::format::format_ipv6;

let bytes = [0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1];
assert_eq!(format_ipv6(&bytes), Some("2001:db8::1".to_string()));