Skip to main content

copybook_codec/
lib.rs

1#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
2// SPDX-License-Identifier: AGPL-3.0-or-later
3#![cfg_attr(
4    test,
5    allow(
6        clippy::expect_used,
7        clippy::unwrap_used,
8        clippy::panic,
9        clippy::duplicated_attributes
10    )
11)]
12//! Encoding and decoding codecs for COBOL data types.
13//!
14//! This crate provides the encoding/decoding logic for COBOL record layouts,
15//! including character set conversion, numeric codecs, and record framing.
16
17/// Character set conversion between EBCDIC codepages and UTF-8.
18pub mod charset;
19/// Determinism validation for decode, encode, and round-trip operations.
20pub mod determinism;
21/// Edited PIC (numeric editing) decode and encode support.
22pub mod edited_pic;
23mod fidelity;
24/// Streaming record iterator for file-level decoding.
25pub mod iterator;
26/// Core library API: record decode/encode and file-level processing.
27pub mod lib_api;
28/// Re-export of [`copybook_codec_memory`] for scratch buffers and streaming.
29pub use copybook_codec_memory as memory;
30/// Numeric field decoding and encoding (zoned decimal, packed decimal, binary).
31pub mod numeric;
32/// Configuration types: codepage, record format, JSON modes, raw capture.
33pub mod options;
34/// Record-level binary decode/encode logic.
35pub mod record;
36/// Zoned decimal overpunch character handling.
37pub mod zoned_overpunch;
38
39mod odo_redefines;
40
41/// Stable JSONL schema identifier for decoder output.
42pub const JSON_SCHEMA_VERSION: &str = "copybook.v1";
43
44pub use iterator::{RecordIterator, iter_records, iter_records_from_file};
45
46pub use lib_api::{
47    RunSummary, decode_file_to_jsonl, decode_record, decode_record_with_scratch,
48    encode_jsonl_to_file, encode_record,
49};
50
51pub use numeric::{SmallDecimal, ZonedEncodingInfo};
52
53pub use options::{
54    Codepage, DecodeOptions, EncodeOptions, FloatFormat, JsonNumberMode, RawMode, RecordFormat,
55    UnmappablePolicy, ZonedEncodingFormat,
56};
57
58pub use determinism::{
59    ByteDiff, DeterminismMode, DeterminismResult, check_decode_determinism,
60    check_encode_determinism, check_round_trip_determinism,
61};