soe_network_parser_lib/modules/
utils.rs1pub fn convert_payload_to_buff(payload: String) -> Vec<u8> {
2 let hex_stream = payload.replace(":", "");
3 let decoded = hex::decode(hex_stream).expect("Decoding failed");
4 return decoded;
5}
6
7pub fn create_if_doesnt_exist(dir: &str) {
8 if !std::fs::metadata(dir).is_err() {
9 std::fs::remove_dir_all(dir).unwrap();
10 }
11 std::fs::create_dir(dir).unwrap();
12}
13
14pub fn get_current_dir() -> String {
15 let cwd = std::env::current_dir().unwrap();
16 return cwd.to_str().unwrap().to_owned();
17}