pub fn parse(
reader: &mut impl BufRead,
format: InputFormat,
items_path: Option<&str>,
) -> Result<ParsedInput, FaceError>Expand description
Parse the input as the chosen format and locate the items array.
The caller has already run crate::input::sniff::sniff_format and
consumed the BOM. items_path overrides automatic items detection
per §4.2 — when Some(path), the parser resolves it via
path::resolve before returning items.
§Errors
FaceError::Iofor I/O failure on the reader.FaceError::InputParsefor parse failure or unsupported raw-parser routes (face-envelope re-processing is handled by the CLI pipeline before raw parsing).FaceError::UnknownItemsPathwhenitems_pathwas supplied but does not resolve.FaceError::AmbiguousDetectionwhen auto-detection cannot pick a unique items array.
§Examples
use std::io::BufReader;
use face_core::input::parse;
use face_core::InputFormat;
let mut r = BufReader::new(b"[1, 2, 3]" as &[u8]);
let parsed = parse(&mut r, InputFormat::Json, None).unwrap();
assert_eq!(parsed.items.len(), 3);
assert!(parsed.skips.is_empty());