Skip to main content

copybook_codec/file/
vb.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2//! Schema-aware VB framing integration.
3//!
4//! `copybook-rdw` owns byte-stream block framing only. Schema-derived minimum
5//! payload validation belongs here, at the codec integration boundary.
6
7use super::rdw::validate_zero_length_record;
8use copybook_core::Schema;
9use copybook_error::Result;
10
11/// Validate a zero-length VB record payload against schema-derived fixed bytes.
12///
13/// VB shares the bare-RDW minimum-payload rule: a record shorter than the
14/// schema fixed prefix is rejected before decode.
15///
16/// # Errors
17/// Returns `CBKF221_RDW_UNDERFLOW` when the schema requires non-zero bytes.
18#[must_use = "handle the VB validation result"]
19#[inline]
20pub fn validate_vb_zero_length_record(schema: &Schema, record_index: u64) -> Result<()> {
21    validate_zero_length_record(schema, record_index)
22}