From 36b4a79a7ec81f6aa630513b1163572a0c546d05 Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Sun, 2 Jun 2024 03:40:18 +0700 Subject: [PATCH] test code --- src/utils.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index 2e00ea3..f298ffa 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -23,7 +23,7 @@ pub fn bytes_into_string(code: &[u8]) -> String { // code.iter().map(|byte| format!("{:02x}", byte)).collect::() // ????? Why do you need this? Why not just String::from_utf8()?? // So we need to turn each byte into a string with a 2-digit hexadecimal representation apparently... - // hex::encode_to_slice(input, output) + let test_res = hex::encode(code); let res = code.iter().fold(String::new(), |mut acc, byte| { acc.push_str(&format!("{:02x}", byte)); @@ -31,6 +31,8 @@ pub fn bytes_into_string(code: &[u8]) -> String { }); // This is the same as the above, but with a fold instead of a map + tracing::debug!(?test_res, ?res, "bytes_into_string"); + // Can we do this with hex::encode instead?