[add] logs and default allocation

This commit is contained in:
2024-10-25 13:12:16 +01:00
parent 228e1a26ac
commit ab46909ced
2 changed files with 4 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ Input:
``` ```
Output: Output:
``` ```csv
google.com google.com
github.com github.com
``` ```

View File

@@ -24,9 +24,10 @@ fn main() -> Result<(), std::io::Error> {
output_file, output_file,
} = ProgramArgs::parse(); } = ProgramArgs::parse();
let mut hosts = Vec::new();
let mut reader = open_buf_reader(&input_file)?; let mut reader = open_buf_reader(&input_file)?;
let mut hosts = Vec::with_capacity(10000);
let mut read_chars_len: usize; let mut read_chars_len: usize;
@@ -71,6 +72,7 @@ fn get_host_from_line(stored_line: &String) -> Option<String> {
let arrays = stored_line.split(" "); let arrays = stored_line.split(" ");
let elements: Vec<&str> = arrays.collect(); let elements: Vec<&str> = arrays.collect();
if elements.len() != 2 { if elements.len() != 2 {
trace!("Expected 2 elements in each line, got {}, ignoring line", elements.len());
return None; return None;
} }
let host_string: String = elements[1].trim_end().into(); let host_string: String = elements[1].trim_end().into();