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:
authormatthew seyer <matthew.seyer@gmail.com>2017-04-21 06:42:12 +0300
committermatthew seyer <matthew.seyer@gmail.com>2017-04-21 06:42:12 +0300
commitc103f961ffca9828fb4ce36a836ea75532df0841 (patch)
treeb39b3c2a6e22289a37e37f7865ad7e3f0007698c /src/utils.rs
parent1e51b18c8abe4e7b7b437ae26301dcac6ba8bbf8 (diff)
initial commit
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()));
+}