#[non_exhaustive]pub enum Error {
Show 15 variants
MissingMtPrefix,
InvalidBase38Char(char, usize),
Base38ChunkOutOfRange {
position: usize,
},
QrPayloadWrongLength {
got: usize,
need: usize,
},
QrTrailingBytes {
extra: usize,
},
ManualCodeWrongLength(usize),
ManualCodeNonDigit(char, usize),
ManualCodeBadChecksum,
FieldOutOfRange {
field: &'static str,
value: u32,
},
DiscriminatorOutOfRange(u16),
PasscodeOutOfRange(u32),
PasscodeDisallowedTrivial(u32),
CommissioningFlowReserved(u8),
QrRequiresVidPid,
CustomFlowUnsupported,
}Expand description
Errors from setup-payload parsing and encoding.
All variants carry enough context (position, value, expected) for callers to render useful diagnostics.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingMtPrefix
QR strings must begin with the four-character MT: prefix.
InvalidBase38Char(char, usize)
A character outside Matter’s 38-character alphabet appeared in the Base38 payload.
Base38ChunkOutOfRange
A Base38 chunk decoded to a value too large for the number of bytes
it produces (e.g. a 2-char chunk > 0xFF), so the encoding is not
injective. chip rejects these (Base38Decode.cpp:152); silently
truncating them would map distinct QR strings to the same bytes.
QrPayloadWrongLength
The Base38-decoded payload is the wrong size for a Matter QR.
Fields
QrTrailingBytes
The Base38-decoded payload is longer than the fixed 11-byte block; M6.1 does not support the optional vendor TLV blob.
ManualCodeWrongLength(usize)
Manual code must be exactly 11 or 21 digits.
ManualCodeNonDigit(char, usize)
Manual code contains a non-digit character.
ManualCodeBadChecksum
The Verhoeff check digit at the end of the manual code did not validate against the preceding digits.
FieldOutOfRange
A manual-code VID or PID field decoded to a 5-digit decimal value
that does not fit in the 16-bit field it maps to (i.e. > 65535).
A manual pairing code carries VID and PID as 5-digit decimals, whose
maximum (99999) exceeds u16::MAX (65535). Rather than silently
truncating an out-of-range value to u16, the parser rejects it.
Fields
DiscriminatorOutOfRange(u16)
The 12-bit Long Discriminator field is out of range.
PasscodeOutOfRange(u32)
The 27-bit Passcode field is out of range.
PasscodeDisallowedTrivial(u32)
The passcode value is on the Matter spec’s disallowed-trivial list (Matter Core Spec §5.1.7.1).
CommissioningFlowReserved(u8)
The 2-bit Commissioning Flow field decoded to a reserved value.
QrRequiresVidPid
encode_qr was called on a SetupPayload whose VID or PID is
None (the manual-code-only case).
CustomFlowUnsupported
The Matter spec defines a Custom commissioning flow whose
semantics are vendor-defined and not supported by matter-rust.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()