use std::{fs::File, io::{self, BufRead}, path::Path, process::exit}; #[derive(Debug)] struct Coord{ line_index: usize, char_index: usize, } fn main() { let symbol_ignore_list = ".123456789"; let mut result = 0; // symbol_array is a list of a list of coords. // each list this array represents a line // inside the line is the list of the coords of each symbol let mut symbol_array: Vec> = Vec::new(); // File hosts.txt must exist in the current path if let Ok(lines) = read_lines("./input") { // Consumes the iterator, returns an (Optional) String let lines_array = lines.flatten().collect::>(); // collect a list of all symbols for line_index in 0..lines_array.len(){ let mut line_symbol_array: Vec = Vec::new(); for char_index in 0..lines_array[line_index].len(){ let cur_char = lines_array[line_index].chars().collect::>()[char_index]; if !symbol_ignore_list.contains(cur_char){ let c = Coord{line_index:line_index,char_index:char_index}; line_symbol_array.push(c); } } symbol_array.push(line_symbol_array); } for line_index in 0..lines_array.len(){ for char_index in 0..lines_array[line_index].len(){ } } } // The output is wrapped in a Result to allow matching on errors. // Returns an Iterator to the Reader of the lines of the file. fn read_lines

(filename: P) -> io::Result>> where P: AsRef, { let file = File::open(filename)?; Ok(io::BufReader::new(file).lines()) }