pub struct Copybook {
pub record_name: String,
pub encoding: String,
pub fields: Vec<FieldDecl>,
}Expand description
A copybook: the record name, the declared character encoding (informational, carried into the packet), and the top-level fields in order.
Fields§
§record_name: StringThe 01-level record name.
encoding: StringThe declared character encoding, e.g. ascii or ebcdic-cp-us. Carried into the packet as
encoding; kobold-csv decodes display bytes as-is and does not transcode.
fields: Vec<FieldDecl>The top-level fields, in record order.
Implementations§
Source§impl Copybook
impl Copybook
Sourcepub fn record_length(&self) -> usize
pub fn record_length(&self) -> usize
The total declared record length = sum of top-level field lengths.
Sourcepub fn leaf_fields(&self) -> Vec<&FieldDecl>
pub fn leaf_fields(&self) -> Vec<&FieldDecl>
A flat, in-order list of the LEAF fields (groups recursed into their children). CSV is inherently a flat tabular format: a row is a sequence of columns, so the export/parse courts work over the leaf fields in record order. This is the bridge from the (possibly nested) copybook tree to columns.
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
A stable, canonical byte serialization of the copybook layout, used as the input to
copybook_hash. Deterministic: a pure function of the structure (names/pics/offsets/lengths/kinds),
independent of insertion-time state.