Skip to main content

classify_distribution_json

Function classify_distribution_json 

Source
pub fn classify_distribution_json(text: &str) -> Result<DistTargetFormat>
Expand description

Distribution parser policy for a .json input.

Classification is by positive marker, never by “everything else is BMOPF”: an unmarked document used to fall through to the BMOPF reader and parse into a bogus near-empty network.

  • PMD carries data_model, which no other family here carries. The marker decides on its own: every real PMD ENGINEERING document also carries the element tables BMOPF uses, so a document holding both is the normal case and not a contradiction.
  • BMOPF carries a bus table beside at least one distribution element table, and no key that marks a PowerModels or MATPOWER derived document.
  • Anything else is refused with a message naming both rules.

Malformed JSON still routes to BMOPF so its reader reports the parse error, which names the byte offset. The probe never materializes the document, so classification costs one pass and constant memory.