#[non_exhaustive]pub enum LengthForm {
Minimal,
Long {
octets: u8,
},
}Expand description
How a length_field is — or is to be — coded on the wire.
A CAM may code a length in a longer form than necessary (82 00 09 for the
value 9, captured raw on hardware, dvb-ci-runtime #337). parse is tolerant
and records the coding here; serialize re-emits exactly that coding, so a
parsed APDU/SPDU/TPDU round-trips byte-for-byte. A value built by hand uses
LengthForm::Minimal (the Default): the shortest legal form.
parse only ever produces LengthForm::Long for a non-minimal coding,
so a parsed object equals the same object built with the default form
whenever the wire used the minimal coding.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Minimal
The shortest legal coding for the value: the 1-byte short form for
0..=127, otherwise the long form with the fewest length octets.
Long
A non-minimal long form (size_indicator = 1) with exactly octets
length octets (1..=MAX_LENGTH_OCTETS), e.g. 82 00 09.
Implementations§
Source§impl LengthForm
impl LengthForm
Sourcepub const fn is_minimal(&self) -> bool
pub const fn is_minimal(&self) -> bool
true for LengthForm::Minimal (used to skip the field in serde).
Trait Implementations§
Source§impl Clone for LengthForm
impl Clone for LengthForm
impl Copy for LengthForm
Source§impl Debug for LengthForm
impl Debug for LengthForm
Source§impl Default for LengthForm
impl Default for LengthForm
Source§impl Display for LengthForm
impl Display for LengthForm
impl Eq for LengthForm
Source§impl Hash for LengthForm
impl Hash for LengthForm
Source§impl PartialEq for LengthForm
impl PartialEq for LengthForm
Source§impl Serialize for LengthForm
Available on crate feature serde only.
impl Serialize for LengthForm
serde only.