hex::encodeした値をhex::decodeした場合、元のStringを .to_owned().into_bytes() としないといけない。
pub static TEST_STRING : &'static str = "hogehoge";
#[tokio::main]
async fn main() {
let hex_string = hex::encode(TEST_STRING);
println!("{}", hex_string);
let hex_string_decode = hex::decode(hex_string).unwrap();
assert_eq!(TEST_STRING.to_owned().into_bytes(), hex_string_decode);
}
assert_eq!(TEST_STRING, hex_string_decode); ではないので、注意が必要。