pub struct SeekDirectory {
pub section_flags: u8,
pub entries: Vec<DirectoryEntry>,
pub classes: Vec<ClassEntry>,
pub channel_lengths: Vec<u64>,
}Expand description
A decoded DIRECTORY record payload.
Field vectors correspond to the sections named by section_flags; vectors for
absent sections are empty.
Fields§
§section_flags: u8Section flags present in the encoded record.
entries: Vec<DirectoryEntry>Record locators in file order, when SECTION_LOCATORS is set.
classes: Vec<ClassEntry>Per-class index, when SECTION_CLASS_INDEX is set.
channel_lengths: Vec<u64>Per-ENTROPY_CHANNEL decoded length in table order, when
SECTION_CHANNEL_LENGTHS is set.
Implementations§
Source§impl SeekDirectory
impl SeekDirectory
Sourcepub fn encode(&self) -> Result<Vec<u8>>
pub fn encode(&self) -> Result<Vec<u8>>
Encode the payload to canonical bytes.
A section’s flag and its vector must agree: a set flag with an empty vector is encoded as a count of zero (valid), but a clear flag with a non-empty vector is an error rather than a silently dropped section.
Sourcepub fn decode(bytes: &[u8], limits: Limits) -> Result<SeekDirectory>
pub fn decode(bytes: &[u8], limits: Limits) -> Result<SeekDirectory>
Decode and structurally bound a payload.
This checks the size bound, the version, the section flags, and that every
section fits its declared count. It does not check agreement with the
actual record framing; call SeekDirectory::validate for that.
Sourcepub fn validate(
&self,
records: &[RecordSite],
file_len: u64,
limits: Limits,
) -> Result<()>
pub fn validate( &self, records: &[RecordSite], file_len: u64, limits: Limits, ) -> Result<()>
Validate the directory against the actual record framing.
Runs the internal structural checks and then requires that Self::entries
agrees byte-for-byte with records (tag, offset, payload length). This is
the advisory cross-check: the directory is a claim, and the framing is the
authority.