use nom::IResult; use std::{collections::BTreeMap, fs}; fn main() -> Result<(), Box> { let input = fs::read_to_string("inputs/day_19.txt")?; let parsed = PartSortingMess::parser(&input).unwrap().1; dbg!(&parsed); Ok(()) } #[derive(Debug)] struct PartSortingMess { workflows: BTreeMap, parts: Vec, } #[derive(Debug)] struct Workflow { id: String, conditions: WorkflowStep, if_none_match: WorkflowOutcome, } #[derive(Debug)] struct WorkflowStep { field: PartField, condition: WorkflowCondition, result: WorkflowOutcome, } #[derive(Debug)] enum PartField { X, M, A, S, } #[derive(Debug)] enum WorkflowCondition { LessThan(u32), GreaterThan(u32), } #[derive(Debug)] enum WorkflowOutcome { Accept, Reject, Defer(String), } #[derive(Debug)] struct Part { x: u32, m: u32, a: u32, s: u32, } impl PartSortingMess { fn parser(input: &str) -> IResult<&str, Self> { todo!() } }