Skip to main content

parse_command

Function parse_command 

Source
pub fn parse_command(line: &[u8]) -> Parsed
Expand description

Parse + validate one request line. Pure: no hardware, no I/O, fully unit-testable. Bad JSON, an unknown op, or a missing required field resolve to Parsed::Error with a stable E_* code; a beep pattern is clamped into the safe bounds here so an out-of-range request is corrected, never rejected outright (the operator still gets a bounded beep). An empty line is a clean E_BAD_REQUEST, never a panic.