pub fn parse_field<T: Packed + Debug>(
width: u32,
given: &str,
) -> Result<T, FieldError>Expand description
Parse a field’s value out of the way the field prints it.
The rendering is the vocabulary: this walks the field’s own bit patterns and takes
the one whose Debug matches, so a type gets string parsing from its Debug alone,
and a value outside its range has no pattern to match and fails here rather than being
clamped.
⚠️ An unexplained value can therefore only be written by naming it as unexplained: a
sparse enum renders an unrecognized 9 as Unknown(9), so a bare 9 matches nothing
and Unknown(9) is the only spelling.