pub struct Metadata { /* private fields */ }Expand description
Validated compact frame metadata, with cached scalar totals only. Append sizes after the corresponding frame has been written successfully.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn from_parts(parts: MetadataParts) -> Result<Self>
pub fn from_parts(parts: MetadataParts) -> Result<Self>
Restore and validate trusted external metadata without copying its arrays. Fixed uncompressed metadata is checked in O(1); indexed modes in O(N).
Sourcepub fn parts(&self) -> &MetadataParts
pub fn parts(&self) -> &MetadataParts
Borrow the validated persistence representation.
Sourcepub fn into_parts(self) -> MetadataParts
pub fn into_parts(self) -> MetadataParts
Transfer the persistence representation without copying.
Sourcepub fn frame_count(&self) -> u64
pub fn frame_count(&self) -> u64
Exact number of frames.
Sourcepub fn logical_len(&self) -> u64
pub fn logical_len(&self) -> u64
Logical object length, in bytes.
Sourcepub fn stored_len(&self) -> u64
pub fn stored_len(&self) -> u64
Stored object length including tags, in bytes.
Sourcepub fn last_frame_len(&self) -> Option<u64>
pub fn last_frame_len(&self) -> Option<u64>
Last raw frame length; absent for an empty object.
Sourcepub fn push(&mut self, sizes: FrameSizes) -> Result<()>
pub fn push(&mut self, sizes: FrameSizes) -> Result<()>
Append one successfully stored frame. Failures leave metadata unchanged. Once a short fixed frame is appended, no further frames may follow it.
Sourcepub fn frame(&self, index: u64) -> Option<FrameSpec>
pub fn frame(&self, index: u64) -> Option<FrameSpec>
Look up a codec descriptor by its original frame index in O(1).
Sourcepub fn range(
&self,
start: u64,
end: Option<u64>,
) -> Result<(Range<u64>, FrameIter<'_>)>
pub fn range( &self, start: u64, end: Option<u64>, ) -> Result<(Range<u64>, FrameIter<'_>)>
Map logical [start, end) bytes to a physical range of complete frames.
None means logical EOF. Empty ranges return 0..0 and an empty iterator.
No allocation, I/O, or decoding occurs. Variable-size layouts scan their
compact index to the last selected frame; fixed uncompressed layouts use arithmetic.