1#[macro_export] 2macro_rules! hex { 3 ($expr:expr) => {{ 4 let mut s = String::new(); 5 for it in $expr { 6 s.push_str(format!("{:02x} ", it).as_str()); 7 } 8 if s.len() > 0 { 9 s = String::from(&s[..s.len()-1]); 10 } 11 12 s 13 }}; 14}