Skip to content
API REFERENCEUsage guides →

cellpack::format::record_nnz ​

fn

Module contract · All interfaces

At a glance ​

pub fn record_nnz(rec: &[u8]) -> Result<usize>

Element count of a record from its header alone: the varint after the flags byte (0 for an empty record). For a sparse record it counts stored entries (explicit zeros included); for a dense record, non-zero values. A caller can compare it with metadata before committing to a decode.

Unlike the record decoders, this reads only the header and checks every byte it reads, so it is safe on arbitrary bytes: a truncated or overlong count is Error::CorruptRecord.

Contract reference ​

See the module reference for semantic input/output rules, units, allocation, mutation, failure behavior, and lifetime requirements. Declarations and documented members are synchronized from the crate source.

Definition