use .value() for instructions

This commit is contained in:
Joe Ardent 2024-12-21 18:11:29 -08:00
parent 6c894246f4
commit 56ca0b72a8

View file

@ -11,7 +11,7 @@ fn main() {
println!("{}", pt2(&input));
}
#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
enum Inst {
Mul(i64, i64),
Do,
@ -56,13 +56,11 @@ fn parse_mul(input: &mut &str) -> PResult<Inst> {
}
fn parse_do(input: &mut &str) -> PResult<Inst> {
let _ = "do()".parse_next(input)?;
Ok(Inst::Do)
"do()".value(Inst::Do).parse_next(input)
}
fn parse_dont(input: &mut &str) -> PResult<Inst> {
let _ = "don't()".parse_next(input)?;
Ok(Inst::Dont)
"don't()".value(Inst::Dont).parse_next(input)
}
fn parse_inst(input: &mut &str) -> PResult<Inst> {