Skip to main content

validate_explicit_binary_width

Function validate_explicit_binary_width 

Source
pub fn validate_explicit_binary_width(width_bytes: u8) -> Result<u16>
Expand description

Validate an explicit USAGE BINARY(n) byte-width declaration and return the equivalent bit width (NORMATIVE).

Only the widths 1, 2, 4, and 8 bytes are valid. Each is converted to the corresponding bit count (8, 16, 32, 64) for downstream codec use.

§Arguments

  • width_bytes - The explicit byte width from the copybook (1, 2, 4, or 8)

§Returns

The equivalent width in bits: 8, 16, 32, or 64.

§Errors

  • CBKE501_JSON_TYPE_MISMATCH - if width_bytes is not 1, 2, 4, or 8

§See Also