use std::fs; use std::io; enum Orientation { N, E, S, W, } enum Instruction { L, R, F, } fn parse_orientation(c: char) -> Result { match c { 'N' => Ok(Orientation::N), 'E' => Ok(Orientation::E), 'S' => Ok(Orientation::S), 'W' => Ok(Orientation::W), _ => Err("Invalid character, does not match any orientations"), } } fn parse_instruction(c: char) -> Result { match c { 'L' => Ok(Instruction::L), 'R' => Ok(Instruction::R), 'F' => Ok(Instruction::F), _ => Err("Invalid character, does not match any instructions"), } } fn open_file(filename: &str) -> io::Result { let content = fs::read_to_string(filename)?; Ok(content) } fn main() { let conf = open_file("two_robots.txt"); }