Add parse_instruction()

Same as the parse_orientation() function but for the instruction model
This commit is contained in:
mhart 2020-10-11 18:31:56 +02:00
parent c1143ee396
commit c2d6e3422d
1 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,15 @@ fn parse_orientation(c: char) -> Option<Orientation> {
} }
} }
fn parse_instruction(c: char) -> Option<Instruction> {
match c {
'L' => Some(Instruction::L),
'R' => Some(Instruction::R),
'F' => Some(Instruction::F),
_ => None,
}
}
fn main() { fn main() {
let file_data = include_str!("../two_robots.txt"); let file_data = include_str!("../two_robots.txt");
} }