Skip to main content

Error

Enum Error 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§position: usize

Byte offset of the offending chunk within the Base38 string.

§

QrPayloadWrongLength

The Base38-decoded payload is the wrong size for a Matter QR.

Fields

§got: usize

Number of bytes actually decoded.

§need: usize

Number of bytes the spec requires (currently always 11).

§

QrTrailingBytes

The Base38-decoded payload is longer than the fixed 11-byte block; M6.1 does not support the optional vendor TLV blob.

Fields

§extra: usize

Number of bytes past the fixed block.

§

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

§field: &'static str

Which field overflowed: "vendor_id" or "product_id".

§value: u32

The out-of-range decimal value parsed from the code.

§

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 Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.