pub struct ChunkHeader {
pub version: u8,
pub chunk_set_id: u32,
pub count: u8,
pub index: u8,
}Expand description
Wire header for a single chunk in a chunked v0.30 payload.
Fields§
§version: u8Wire-format version (4 bits). v0.30 = 4.
chunk_set_id: u3220-bit chunk-set identifier shared by all chunks in a set.
count: u8Total number of chunks in the set; valid range 1..=64.
index: u8Zero-based index of this chunk within the set; must be < count.
Implementations§
Source§impl ChunkHeader
impl ChunkHeader
Sourcepub fn write(&self, w: &mut BitWriter) -> Result<(), Error>
pub fn write(&self, w: &mut BitWriter) -> Result<(), Error>
Encode the chunk header into w as 37 bits.
Returns an error if count, index, or chunk_set_id are out of range.
Sourcepub fn read(r: &mut BitReader<'_>) -> Result<Self, Error>
pub fn read(r: &mut BitReader<'_>) -> Result<Self, Error>
Decode a chunk header (37 bits) from r.
Returns Error::WireVersionMismatch if the 4-bit version field
is not WF_REDESIGN_VERSION per SPEC §2.5 (e.g., v0.x chunked
payloads where version=0 in the first 3 wire bits become version=0
or version=1 under the v0.30 4-bit read depending on prior bits).
Returns Error::ChunkHeaderChunkedFlagMissing if the chunked-flag
bit is not set after the version check passes.
Trait Implementations§
Source§impl Clone for ChunkHeader
impl Clone for ChunkHeader
Source§fn clone(&self) -> ChunkHeader
fn clone(&self) -> ChunkHeader
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 ChunkHeader
impl Debug for ChunkHeader
Source§impl PartialEq for ChunkHeader
impl PartialEq for ChunkHeader
Source§fn eq(&self, other: &ChunkHeader) -> bool
fn eq(&self, other: &ChunkHeader) -> bool
self and other values to be equal, and is used by ==.