From c2d6e3422df63c86d4042bc901a3131a5218d86e Mon Sep 17 00:00:00 2001 From: mhart Date: Sun, 11 Oct 2020 18:31:56 +0200 Subject: [PATCH] Add parse_instruction() Same as the parse_orientation() function but for the instruction model --- src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.rs b/src/main.rs index 4052eaf..313f30a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,15 @@ fn parse_orientation(c: char) -> Option { } } +fn parse_instruction(c: char) -> Option { + match c { + 'L' => Some(Instruction::L), + 'R' => Some(Instruction::R), + 'F' => Some(Instruction::F), + _ => None, + } +} + fn main() { let file_data = include_str!("../two_robots.txt"); }