// 引用依赖
[dev-dependencies]
hex = "0.3.2"
// 打印bytes
let xx = format!("{}", hex::encode(&key[..]));
println!("x: {}",xx);
println!("===============================");
let result = hex::decode("").unwrap();
use alloc::string::String;
use alloc::vec::Vec;
static CHARS: &'static[u8] = b"0123456789abcdef";
fn to_hex(dest: &[u8]) -> String {
let mut v = Vec::with_capacity(&dest.len() * 2);
for &byte in dest.iter() {
v.push(CHARS[(byte >> 4) as usize]);
v.push(CHARS[(byte & 0xf) as usize]);
}
unsafe {
String::from_utf8_unchecked(v)
}
}
let hex = to_hex(&r.to_bytes());
println!("hex {}", hex);