Skip to main content

ErrorCode

Enum ErrorCode 

Source
pub enum ErrorCode {
    EParam,
    ELength,
    ENotConfigured,
    EModulation,
    EUnknownCmd,
    EBusy,
    ERadio,
    EFrame,
    EInternal,
    Unknown(u16),
}
Expand description

Wire-level error code.

Parsing an unknown code yields ErrorCode::Unknown(raw) so hosts can round-trip frames they don’t fully understand (useful when a device reports a newer minor-version error code).

Variants§

§

EParam

0x0001 — a parameter value is out of range or invalid.

§

ELength

0x0002 — payload length is wrong for the command or modulation.

§

ENotConfigured

0x0003 — command requires CONFIGURED; device is UNCONFIGURED.

§

EModulation

0x0004 — requested modulation is not supported by this chip.

§

EUnknownCmd

0x0005 — unknown command type byte.

§

EBusy

0x0006 — transient: TX queue is full. Retry after a TX_DONE.

§

ERadio

0x0101 — radio SPI error or unexpected hardware state.

§

EFrame

0x0102 — inbound frame had bad CRC, bad COBS, or wrong length.

§

EInternal

0x0103 — firmware encountered an unexpected internal condition.

§

Unknown(u16)

Any code not assigned in v1.0. Preserves the raw wire value so parsers don’t drop information they don’t understand.

Implementations§

Source§

impl ErrorCode

Source

pub const fn as_u16(self) -> u16

Wire-form u16.

Source

pub const fn from_u16(v: u16) -> Self

Parse a wire u16. Assigned codes return their named variant; anything else becomes Unknown(raw).

Source

pub const fn is_async_range(self) -> bool

Whether this code lives in the asynchronous-typical range (0x0100..=0x01FF). Does not imply the containing frame’s tag; that’s a separate wire-level fact.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ErrorCode

Source§

impl Debug for ErrorCode

Source§

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

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

impl Eq for ErrorCode

Source§

impl Format for ErrorCode

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &ErrorCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, 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.