format_mac

Function format_mac 

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

Format 6 bytes as a MAC address string in colon-separated hex format.

Returns None if the slice is not exactly 6 bytes.

ยงExample

use pcapsql_core::format::format_mac;

let bytes = [0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff];
assert_eq!(format_mac(&bytes), Some("aa:bb:cc:dd:ee:ff".to_string()));