pub fn decode_file_to_jsonl(
schema: &Schema,
input: impl Read,
output: impl Write,
options: &DecodeOptions,
) -> Result<RunSummary>Expand description
Decode a file to JSONL format
Reads records from input using the configured RecordFormat
When options.threads is greater than one, records are decoded through a
bounded worker pool and emitted in input order. A zero thread setting uses
one worker for a safe single-threaded fallback; requests above the safe
worker limit are capped.
§Examples
use copybook_core::parse_copybook;
use copybook_codec::{decode_file_to_jsonl, DecodeOptions};
use copybook_codec::options::{Codepage, RecordFormat};
let schema = parse_copybook("01 FLD PIC X(5).").unwrap();
let input: &[u8] = b"HELLOWORLD"; // Two 5-byte records
let mut output = Vec::new();
let options = DecodeOptions::new()
.with_codepage(Codepage::ASCII)
.with_format(RecordFormat::Fixed);
let summary = decode_file_to_jsonl(&schema, input, &mut output, &options).unwrap();
assert_eq!(summary.records_processed, 2);§Errors
Returns an error if the input cannot be read, decoded, or written.