decode_step_binary

Function decode_step_binary 

Source
pub fn decode_step_binary(raw: &[u8]) -> Option<Vec<u8>>
Expand description

Decode a STEP binary literal ("0FF") to its bytes: the one home for byte decoding of BINARY values (F4-1).

raw is the literal’s content, as crate::AttributeValue::Binary holds it, or the literal with its surrounding quotes. The first hex digit is the number of unused bits in the last byte; the rest is whole bytes, two hex digits each, either case.

Refuses (None) what it cannot decode exactly, instead of the old “skip the indicator and stop at the first bad digit”: a non-zero indicator (D18: the bytes are not byte-aligned, so no whole-byte reader can use them), an indicator above 3, an odd count of hex digits and a non-hex byte. "0" is the empty binary.