#[non_exhaustive]pub enum Count {
Field {
by: By,
cap: Option<usize>,
},
Squared {
by: By,
cap: Option<usize>,
},
Strided {
by: By,
cap: Option<usize>,
stride: By,
},
Window(Len),
Terminated {
mask: u8,
},
Fill {
cap: Option<usize>,
},
}Expand description
How many elements a collection has.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Field
Read from an earlier integer field: count = field * scale + offset.
Squared
The square of an earlier field’s value. Encode derives the field from the length.
Fields
Strided
A count from one field and each element’s byte size from another.
Decode reads each element from the start of its stride. A stride shorter than the element
is ParseError::Malformed.
Fields
Window(Len)
As many elements as fit a byte length.
The elements must fill it exactly, or decode returns
ParseError::Malformed. With Len::Until, one-byte
elements run up to a terminator, which is not included. Len::Fill is not allowed:
use Count::Fill.
Terminated
Elements up to and including the first with a mask bit set, as in HDLC addresses.
The element type declares that bit as a prefix, and encode sets it. Fields can follow.
Fill
As many elements as fill the rest of the body exactly.