1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use std::fs::{ File }; use std::io::{ BufRead, BufReader }; pub mod flex; pub mod io; pub mod mapper; pub fn load_flex_file(file_name: &str) -> Result<Vec<String>, String> { match File::open(file_name) { Ok(f) => { let reader = BufReader::new(f); let lines = reader.lines(); let mut ln: Vec<String> = vec![]; for line in lines { ln.push(line.unwrap()); } Ok(ln) }, Err(_e) => Err("The FlexMapper needs two lines in the flex file.".to_string()) } }