1 2 3 4 5 6 7 8 9 10 11 12 13
pub enum Instruction { Add(i64), Noop } pub fn read_instruction(line: &str) -> Instruction { if &line[..4] == "addx" { let n = line[5..line.len()-1].parse::<i64>().unwrap(); Instruction::Add(n) } else { Instruction::Noop } }
Generated with cgit - Back to sebastiano.tronto.net