#[repr(u8)]pub enum LengthCode {
Lc0 = 0,
Lc1 = 1,
Lc2 = 2,
Lc3 = 3,
Lc4 = 4,
Lc5 = 5,
Lc6 = 6,
Lc7 = 7,
}Expand description
Length-code variant (XTypes 1.3 §7.4.3.4.2). WP 1.A: all 8 LCs.
Variants§
Lc0 = 0
1-byte body, no NEXTINT.
Lc1 = 1
2-byte body, no NEXTINT.
Lc2 = 2
4-byte body, no NEXTINT.
Lc3 = 3
8-byte body, no NEXTINT.
Lc4 = 4
Variable-length body, NEXTINT (uint32) = body length in bytes.
Lc5 = 5
Variable-length aggregate, NEXTINT = body length INCLUDING DHEADER.
Lc6 = 6
Array of 4-byte primitives, NEXTINT = element count, body = 4 + 4*N.
Lc7 = 7
Array of 8-byte primitives, NEXTINT = element count, body = 4 + 8*N.
Implementations§
Source§impl LengthCode
impl LengthCode
Sourcepub fn body_len(self, framing_word: u32) -> u64
pub fn body_len(self, framing_word: u32) -> u64
Body length in bytes for this LC, given the NEXTINT value.
Sourcepub const fn has_nextint(self) -> bool
pub const fn has_nextint(self) -> bool
true if a NEXTINT is serialized separately after the EMHEADER
(only LC4). LC5/6/7 reuse the body’s own leading length word, so
they carry no separate NEXTINT — see Self::reuses_leading_len.
Sourcepub const fn reuses_leading_len(self) -> bool
pub const fn reuses_leading_len(self) -> bool
true if the LC reuses the member body’s own leading 4-byte length
word as the NEXTINT (LC5/6/7, §7.4.3.4.2) — no separate NEXTINT on
the wire; the word stays as the first 4 bytes of the member body.
Trait Implementations§
Source§impl Clone for LengthCode
impl Clone for LengthCode
Source§fn clone(&self) -> LengthCode
fn clone(&self) -> LengthCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more