use nom::{branch::alt, bytes::complete::tag, combinator::map, IResult}; use crate::prob7::Instructions::{Cd, Dir, Ls}; enum Instructions { Ls, Cd, Dir, } fn parse_instruction(i: &str) -> IResult<&str, Instructions> { alt(( map(tag("ls"), |_| Ls), map(tag("cd"), |_| Cd), map(tag("dir"), |_| Dir), ))(i) }