pub struct FrameBlock {
pub offset_in_frame: u32,
pub header_size: u8,
pub body_size: u32,
pub block_size_field: u32,
pub block_type: BlockType,
pub last_block: bool,
}lsm only.Expand description
Layout of a single zstd block inside an emitted frame.
Offsets are absolute byte positions in the emitted-frame buffer:
offset_in_frame points at the first byte of the 3-byte
Block_Header, and the block body lives at
offset_in_frame + header_size .. offset_in_frame + header_size + body_size. The arithmetic
offset_in_frame + header_size as u32 + body_size
is the byte offset of the next block (or, on the last block, of
the trailing checksum / end of frame).
For RLE blocks the body_size is 1 (the single repeated byte
on the wire); the spec’s Block_Size field carries the logical
repeat count instead and is surfaced separately as
block_size_field.
Fields§
§offset_in_frame: u32Byte offset of this block’s Block_Header within the emitted
frame buffer (frame-absolute, includes the bytes consumed by
the frame header / magic / FCS that precede the first block).
header_size: u8Size of the Block_Header in bytes. Always 3 today; carried
as a field so the API stays forward-compatible with any future
spec extension that widens the header.
body_size: u32Physical length of this block’s body in bytes on the wire (does
NOT include header_size). For Raw / Compressed blocks this is
the number of bytes after the header; for RLE blocks this is
always 1 (the repeated byte itself, while the spec’s
Block_Size field encodes the logical repeat count — see
block_size_field). The arithmetic
offset_in_frame + header_size as u32 + body_size always
lands on the next block boundary.
block_size_field: u32Raw Block_Size value from the 3-byte Block_Header. For Raw
and Compressed blocks this equals body_size; for RLE blocks
it’s the logical repeat count (how many bytes the single
physical body byte expands to during decode) and will differ
from body_size (which is 1).
block_type: BlockTypeWhether the block is Raw, RLE, or Compressed per RFC 8878
§3.1.1.2.1 (Block_Type).
last_block: booltrue only on the final block of the frame (matches the
Last_Block flag in Block_Header).
Trait Implementations§
Source§impl Clone for FrameBlock
impl Clone for FrameBlock
Source§fn clone(&self) -> FrameBlock
fn clone(&self) -> FrameBlock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FrameBlock
impl Debug for FrameBlock
Source§impl PartialEq for FrameBlock
impl PartialEq for FrameBlock
Source§fn eq(&self, other: &FrameBlock) -> bool
fn eq(&self, other: &FrameBlock) -> bool
self and other values to be equal, and is used by ==.