Skip to content
API REFERENCEUsage guides →

cellpack::format::cpk::parse_superblock ​

fn

Module contract · All interfaces

At a glance ​

pub fn parse_superblock(b: &[u8]) -> Result<Superblock>

Parses a superblock (at least SUPERBLOCK_LEN bytes) and checks its fields against each other; the hash is checked by parse_directory.

Checks magic, version, the reserved bytes, a known dtype and source code, a power-of-two page size in [512, 65536], a non-zero column count, and that the directory ends the file exactly. A file whose writer stopped before the superblock has no valid magic, which is how a truncated write is detected.

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