seedelf_cli::koios

Function extract_bytes_with_logging

Source
pub fn extract_bytes_with_logging(
    inline_datum: &Option<InlineDatum>,
) -> Option<Register>
Expand description

Extracts byte values from an InlineDatum with detailed logging.

This function attempts to extract two byte strings from the fields array inside the InlineDatum. If the extraction fails due to missing keys, incorrect types, or insufficient elements, an error message is logged to standard error.

§Arguments

  • inline_datum - An optional reference to an InlineDatum. The InlineDatum is expected to contain a value key, which maps to an object with a fields array of at least two elements.

§Returns

  • Some(Register) - A Register instance containing the two extracted byte strings.
  • None - If the extraction fails or inline_datum is None.

§Behavior

Logs errors to stderr using eprintln! when:

  • inline_datum is None.
  • The value key is missing or is not an object.
  • The fields key is missing or is not an array.
  • The fields array has fewer than two elements.