use std::io;
pub fn other(desc: &str) -> io::Error {
io::Error::new(io::ErrorKind::Other, desc)
}
pub fn as_hex(buf: &[u8]) -> String {
let mut hexy = String::new();
for (idx, byte) in buf.iter().enumerate() {
if idx % 16 == 0 {
hexy.push_str(&format!("{:08x}:", idx))
}
hexy.push_str(&format!(" 0x{:02x}", byte));
if idx % 16 == 15 {
hexy.push('\n');
}
}
hexy
}