Skip to main content

Module record

Module record 

Source
Expand description

Length-delimited record framing.

record := tag:u8 flags:u8 reserved:u16=0 length:u32 payload:[u8;length] crc32c:u32

The CRC covers the 8-byte record header and the payload. reserved must be zero. The flags bit FLAG_OPTIONAL marks a record whose tag a decoder may skip if unknown; unknown non-optional tags fail closed.

Structs§

Record
A single decoded record.
RecordReader
An iterator over the records of a byte slice.

Enums§

RecordTag
Known record classes.

Constants§

FLAG_OPTIONAL
Flag: this record’s tag may be skipped by a decoder that does not know it.
RECORD_HEADER_LEN
Bytes of per-record framing before the payload.
RECORD_OVERHEAD
Total framing overhead per record.
RECORD_TRAILER_LEN
Bytes of per-record framing after the payload (the CRC).

Functions§

read_record_at
Read and CRC-check exactly one record located at offset in a seekable source.
write_record
Append an encoded record to out. payload must fit in u32.