Improve saving format

This commit is contained in:
Michael Mikovsky
2025-04-17 16:27:45 -06:00
parent f927719b06
commit ddfee03266
6 changed files with 103 additions and 81 deletions
+1 -12
View File
@@ -20,18 +20,7 @@ impl ScanResult {
pub fn to_string_row(&self) -> StringRow {
StringRow {
id: self.ip.to_string(),
values: vec![join_nums(&self.open_ports, ",")],
ports: (*self.open_ports).to_vec(),
}
}
}
fn join_nums(nums: &Vec<i32>, sep: &str) -> String {
// 1. Convert numbers to strings
let str_nums: Vec<String> = nums
.iter()
.map(|n| n.to_string()) // map every integer to a string
.collect(); // collect the strings into the vector
// 2. Join the strings. There's already a function for this.
str_nums.join(sep)
}