pub enum CodecError {
HeaderTooShort,
UnsupportedVersion(u8),
ReservedTokenLength(u8),
TokenTruncated,
OptionHeaderTruncated,
OptionDeltaIs15,
OptionLengthIs15,
OptionValueTruncated,
PayloadMarkerWithoutPayload,
EncodeTokenTooLong,
}Expand description
Codec error — spec-conformant “MUST be processed as a message format error” cases.
Variants§
HeaderTooShort
Header too short (< 4 bytes).
UnsupportedVersion(u8)
Spec §3 — “Implementations MUST set this field to 1 (01 binary). Other values are reserved […]. Messages with unknown version numbers MUST be silently ignored.” We return an explicit error to the caller.
ReservedTokenLength(u8)
Spec §3 — “Lengths 9-15 are reserved, MUST NOT be sent, and MUST be processed as a message format error.”
TokenTruncated
Token does not fit in the available bytes.
OptionHeaderTruncated
Option header does not fit in the available bytes.
OptionDeltaIs15
Spec §3.1 — “15: Reserved for the Payload Marker. If the field is set to this value but the entire byte is not the payload marker, this MUST be processed as a message format error.”
OptionLengthIs15
Spec §3.1 — Option length 15 reserved.
OptionValueTruncated
Option value does not fit in the available bytes.
PayloadMarkerWithoutPayload
Spec §3 — “The presence of a marker followed by a zero-length payload MUST be processed as a message format error.”
EncodeTokenTooLong
Token length is > 8 on encode (caller error).
Trait Implementations§
Source§impl Clone for CodecError
impl Clone for CodecError
Source§fn clone(&self) -> CodecError
fn clone(&self) -> CodecError
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 CodecError
impl Debug for CodecError
Source§impl Display for CodecError
impl Display for CodecError
impl Eq for CodecError
Source§impl Error for CodecError
Available on crate feature std only.
impl Error for CodecError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for CodecError
impl PartialEq for CodecError
Source§fn eq(&self, other: &CodecError) -> bool
fn eq(&self, other: &CodecError) -> bool
self and other values to be equal, and is used by ==.