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;
23/// Schema-aware file framing integration.
24pub mod file;
25/// Streaming record iterator for file-level decoding.
26pub mod iterator;
27/// Core library API: record decode/encode and file-level processing.
28pub mod lib_api;
29/// Codec-owned runtime support for scratch buffers, streaming, and workers.
30pub mod runtime;
31/// Compatibility alias for the pre-0.6 memory module path.
32pub use runtime as memory;
33/// Numeric field decoding and encoding (zoned decimal, packed decimal, binary).
34pub mod numeric;
35/// Configuration types: codepage, record format, JSON modes, raw capture.
36pub mod options;
37/// Record-level binary decode/encode logic.
38pub mod record;
39/// Zoned decimal overpunch character handling.
40pub mod zoned_overpunch;
41
42mod odo_redefines;
43
44/// Stable JSONL schema identifier for decoder output.
45pub const JSON_SCHEMA_VERSION: &str = "copybook.v1";
46
47pub use iterator::{RecordIterator, iter_records, iter_records_from_file};
48
49pub use lib_api::{
50    MAX_CAPTURED_FAILURES, RecordFailure, RunSummary, decode_file_to_jsonl, decode_record,
51    decode_record_with_scratch, encode_jsonl_to_file, encode_record,
52};
53
54pub use numeric::{SmallDecimal, ZonedEncodingInfo};
55
56pub use options::{
57    CodecOptionKind, Codepage, DecodeOptions, EncodeOptions, FloatFormat, JsonNumberMode,
58    ParseCodecOptionError, RawMode, RecordFormat, UnmappablePolicy, ZonedEncodingFormat,
59};
60
61pub use determinism::{
62    ByteDiff, DeterminismMode, DeterminismResult, check_decode_determinism,
63    check_encode_determinism, check_round_trip_determinism,
64};