Skip to main content

parse_octet_sequence

Function parse_octet_sequence 

Source
pub fn parse_octet_sequence(s: &str) -> Result<Vec<u8>, XmlError>
Expand description

Octet sequence parser per Spec §7.2.4.2 (comma-separated decimal/hex). Each element is an octet (u8).

Accepts:

  • Comma-separated decimal: 0,1,2,255.
  • Comma-separated hex (prefix 0x / 0X): 0x00,0xFF.
  • Mixed allowed: 1,0x02,3 (each element is parsed individually).
  • Whitespace around commas is trimmed.
  • Empty string -> empty sequence.

Rejected:

  • Values outside 0..=255.
  • Trailing comma (e.g. 1,2,).
  • Non-numeric tokens.

For Base64-encoded octet sequences see qos_parser::base64_decode — the spec allows either a comma list or Base64, distinguished by the element name (<value> vs. <valueB64>).

§Errors

XmlError::ValueOutOfRange on range/format errors.