use std::fmt; mod helpers; enum Direction { North, East, South, West } struct Position { x: i32, y: i32, dir: Direction, } impl fmt::Display for Position { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "({}, {}: {})", self.x, self.y, string_dir(self.dir)) } } fn string_dir(d: Direction) -> String { match d { Direction::North => String::from("North"), Direction::East => String::from("East"), Direction::South => String::from("South"), Direction::West => String::from("West"), } } fn main() { let input = helpers::read_std_in(); let split = input.split(","); for mut s in split { s = s.trim(); println!("{}", s); } let p = Position{ x: 0, y: 0, dir: Direction::North }; println!("{}", p) }