Though all crate::helper::bit_fields_u* helper functions are fundamentally a CommonOp::EndianParse(_) wrapped in Map(_, Compute(..)), the introspection required to recognize such Formats as fixed-shape is currently missing. Rather than delve too deeply into the Format structure, it would be ideal to encode this structure at the top-level with a new StyleHint for "read a value of a given BaseKind and transform the value without any other parsing operations".
This has additional requirements for ReadArray purposes in generated code, however, as we would have to also generate the appropriate ReadUnchecked impl for each ad-hoc type corresponding to a bit_fields_u* FormatRef. At minimum, we would have to preserve sufficient details of what parse is performed, and emit some inline or standalone-fn mapping from the parsed machine-int value to the record-structure in question.
Though all
crate::helper::bit_fields_u*helper functions are fundamentally aCommonOp::EndianParse(_)wrapped inMap(_, Compute(..)), the introspection required to recognize suchFormatsas fixed-shape is currently missing. Rather than delve too deeply into the Format structure, it would be ideal to encode this structure at the top-level with a newStyleHintfor "read a value of a given BaseKind and transform the value without any other parsing operations".This has additional requirements for
ReadArraypurposes in generated code, however, as we would have to also generate the appropriateReadUncheckedimpl for each ad-hoc type corresponding to abit_fields_u*FormatRef. At minimum, we would have to preserve sufficient details of what parse is performed, and emit some inline or standalone-fn mapping from the parsed machine-int value to the record-structure in question.