1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::collections::HashMap;
use preprocessor::Preprocessor;
use binary_object::BinaryObject;
pub struct HexPreprocessor;
impl Preprocessor for HexPreprocessor {
fn process(&self, binary_object: &BinaryObject) -> HashMap<String, String> {
let mut string = String::new();
for byte in &binary_object.data {
string.push_str(&format!("{:02X} ", byte));
}
hashmap! {
String::from("hex_data") => string
}
}
fn info(&self) -> (&'static str, &'static str) {
("hex", "creates a hexadecimal byte representation")
}
}