pub enum LengthEncoding {
TypeLengthValue {
option_len_multiplier: NonZeroUsize,
},
ValueOnly,
}Expand description
Whether the length field of an option encodes the length of the entire option (including kind and length fields) or only of the value field.
For the TypeLengthValue variant, an option_len_multiplier may also
be specified. Some formats (such as NDP) do not directly encode the
length in bytes of each option, but instead encode a number which must
be multiplied by option_len_multiplier in order to get the length in
bytes.
Variants§
Implementations§
Source§impl LengthEncoding
impl LengthEncoding
Sourcepub fn encode_length<F: KindLenField>(self, option_body_len: usize) -> Option<F>
pub fn encode_length<F: KindLenField>(self, option_body_len: usize) -> Option<F>
Encodes the length of an option’s body.
option_body_len is the length in bytes of the body option as
returned from [OptionsSerializerImpl::option_length]. This value
does not include the kind, length, or padding bytes.
encode_length computes the value which should be stored in the
length field, returning None if the value cannot be stored in an
F.
Trait Implementations§
Source§impl Clone for LengthEncoding
impl Clone for LengthEncoding
Source§fn clone(&self) -> LengthEncoding
fn clone(&self) -> LengthEncoding
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more