Skip to main content

pio_classify_str

Function pio_classify_str 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pio_classify_str( text: *const c_char, outbuf: *mut c_char, outlen: usize, ) -> usize
Expand description

Classify in-memory JSON case text by its top level markers, without parsing the case. Writes one of

  • transmission:<format> (e.g. transmission:powermodels-json)
  • distribution:<format> (e.g. distribution:pmd-json)
  • package (a .pio.json package; read it with the package entry points)
  • ambiguous (strong markers from both domains; pass an explicit format)
  • unknown (no recognized marker, or not a JSON object)

into the caller outbuf (truncated to fit, always NUL-terminated) and returns the total byte length of the classification string (the size-then-fill idiom of pio_warnings). Returns 0 for NULL text. The markers are the same ones the transmission parser’s .json sniffing uses, so a binding can route a bare .json before choosing a parser.