pub struct DecodeOptions {Show 13 fields
pub format: RecordFormat,
pub codepage: Codepage,
pub json_number_mode: JsonNumberMode,
pub emit_filler: bool,
pub emit_meta: bool,
pub emit_raw: RawMode,
pub strict_mode: bool,
pub max_errors: Option<u64>,
pub on_decode_unmappable: UnmappablePolicy,
pub threads: usize,
pub preserve_zoned_encoding: bool,
pub preferred_zoned_encoding: ZonedEncodingFormat,
pub float_format: FloatFormat,
}Expand description
Options for decoding operations
Fields§
§format: RecordFormatRecord format
codepage: CodepageCharacter encoding
json_number_mode: JsonNumberModeJSON number representation
emit_filler: boolWhether to emit FILLER fields
emit_meta: boolWhether to emit metadata
emit_raw: RawModeRaw data capture mode
strict_mode: boolError handling mode
max_errors: Option<u64>Maximum errors before stopping
on_decode_unmappable: UnmappablePolicyPolicy for unmappable characters
threads: usizeNumber of threads for parallel processing
preserve_zoned_encoding: boolEnable zoned decimal encoding preservation for binary round-trip consistency
When enabled, the decoder captures the original encoding format (ASCII vs EBCDIC) and includes it in metadata for use during re-encoding to maintain byte-level fidelity in encode/decode cycles.
preferred_zoned_encoding: ZonedEncodingFormatPreferred encoding format when auto-detection is ambiguous
Used as fallback when ZonedEncodingFormat::Auto cannot determine the format
from the data (e.g., all-zero fields, mixed encodings).
float_format: FloatFormatFloating-point representation for COMP-1/COMP-2 fields.
Implementations§
Source§impl DecodeOptions
impl DecodeOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new decode options with default values
Returns options configured for:
- Fixed record format
- CP037 EBCDIC codepage
- Lossless JSON number mode
- Single-threaded processing
Use the builder methods to customize:
§Examples
use copybook_options::{DecodeOptions, Codepage, JsonNumberMode, RecordFormat, RawMode};
let opts = DecodeOptions::new()
.with_codepage(Codepage::CP037)
.with_format(RecordFormat::Fixed)
.with_json_number_mode(JsonNumberMode::Lossless)
.with_emit_meta(true)
.with_threads(4);
assert_eq!(opts.threads, 4);
assert!(opts.emit_meta);Sourcepub fn with_format(self, format: RecordFormat) -> Self
pub fn with_format(self, format: RecordFormat) -> Self
Set the record format
Sourcepub fn with_codepage(self, codepage: Codepage) -> Self
pub fn with_codepage(self, codepage: Codepage) -> Self
Set the codepage
Sourcepub fn with_json_number_mode(self, mode: JsonNumberMode) -> Self
pub fn with_json_number_mode(self, mode: JsonNumberMode) -> Self
Set the JSON number mode
Sourcepub fn with_emit_filler(self, emit_filler: bool) -> Self
pub fn with_emit_filler(self, emit_filler: bool) -> Self
Enable or disable FILLER field emission
Sourcepub fn with_emit_meta(self, emit_meta: bool) -> Self
pub fn with_emit_meta(self, emit_meta: bool) -> Self
Enable or disable metadata emission
Sourcepub fn with_emit_raw(self, emit_raw: RawMode) -> Self
pub fn with_emit_raw(self, emit_raw: RawMode) -> Self
Set the raw data capture mode
Controls whether and how raw binary data is included in decode output:
RawMode::Off— no raw data (default)RawMode::Record— record payload in__raw_b64RawMode::RecordRDW— RDW header + payload in__raw_b64RawMode::Field— per-field raw values in<FIELD>__raw_b64
Sourcepub fn with_strict_mode(self, strict_mode: bool) -> Self
pub fn with_strict_mode(self, strict_mode: bool) -> Self
Enable or disable strict mode
Sourcepub fn with_max_errors(self, max_errors: Option<u64>) -> Self
pub fn with_max_errors(self, max_errors: Option<u64>) -> Self
Set the maximum number of errors before stopping
Sourcepub fn with_unmappable_policy(self, policy: UnmappablePolicy) -> Self
pub fn with_unmappable_policy(self, policy: UnmappablePolicy) -> Self
Set the policy for unmappable characters
Sourcepub fn with_threads(self, threads: usize) -> Self
pub fn with_threads(self, threads: usize) -> Self
Set the number of threads for parallel processing
Sourcepub fn with_preserve_zoned_encoding(self, preserve_zoned_encoding: bool) -> Self
pub fn with_preserve_zoned_encoding(self, preserve_zoned_encoding: bool) -> Self
Enable zoned decimal encoding preservation for round-trip fidelity
When enabled, the decoder will detect and preserve the original encoding format (ASCII vs EBCDIC) for use during subsequent encoding operations. This ensures byte-level consistency in encode/decode cycles.
Sourcepub fn with_preferred_zoned_encoding(
self,
preferred_zoned_encoding: ZonedEncodingFormat,
) -> Self
pub fn with_preferred_zoned_encoding( self, preferred_zoned_encoding: ZonedEncodingFormat, ) -> Self
Set the preferred zoned encoding format for ambiguous detection
This format is used as a fallback when auto-detection cannot determine the encoding from the data (e.g., all-zero fields, mixed encodings).
Sourcepub fn with_float_format(self, float_format: FloatFormat) -> Self
pub fn with_float_format(self, float_format: FloatFormat) -> Self
Set floating-point representation for COMP-1/COMP-2 fields
Trait Implementations§
Source§impl Clone for DecodeOptions
impl Clone for DecodeOptions
Source§fn clone(&self) -> DecodeOptions
fn clone(&self) -> DecodeOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more