Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/RustyMft.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs
new file mode 100644
index 0000000..7bda5c9
--- /dev/null
+++ b/src/utils.rs
@@ -0,0 +1,10 @@
+pub fn to_hex_string(bytes: &Vec<u8>) -> String {
+ let strs: Vec<String> = bytes.iter()
+ .map(|b| format!("{:02X}", b))
+ .collect();
+ strs.join("")
+}
+
+pub fn print_buffer_as_hex(buffer: &[u8]) {
+ println!("{}",to_hex_string(&buffer.to_vec()));
+}