Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 17 variants PayloadNotBuilt, HeaderNotBuilt, OutOfBounds { source: &'static str, variable: &'static str, }, SliceTooSmall, InvalidProtocolVersion { value: u8, }, InvalidNackCode { value: u8, }, InvalidActionCode { value: u8, }, InvalidSyncStatus { value: u8, }, InvalidActivationCode { value: u8, }, InvalidActivationType { value: u8, }, InvalidNodeType { value: u8, }, InvalidPowerMode { value: u8, }, InvalidDiagnosticNackCode { value: u8, }, InvalidDiagnosticAckCode { value: u8, }, InvalidPayloadType { value: [u8; 2], }, BufferTooSmall { size: usize, }, SliceError(TryFromSliceError),
}
Expand description

Custom Error enum for deriving error types across the application and API.

Expand to fit new dependencies using #[from] and implement custom error types with context.

Variants§

§

PayloadNotBuilt

When utilising the builder pattern the payload is not present

§

HeaderNotBuilt

When utilising the builder pattern the header is not present

§

OutOfBounds

Errors when accessing a range out of the slices scope.

Fields

§source: &'static str

Source struct

§variable: &'static str

Destination variable

§

SliceTooSmall

When a slice is too small to be written to

§

InvalidProtocolVersion

Invalid ProtocolVersion

Fields

§value: u8

Value

§

InvalidNackCode

Invalid NackCode

Fields

§value: u8

Value

§

InvalidActionCode

Invalid ActionCode

Fields

§value: u8

Value

§

InvalidSyncStatus

Invalid SyncStatus

Fields

§value: u8

Value

§

InvalidActivationCode

Invalid ActivationCode

Fields

§value: u8

Value

§

InvalidActivationType

Invalid ActivationType

Fields

§value: u8

Value

§

InvalidNodeType

Invalid NodeType

Fields

§value: u8

Value

§

InvalidPowerMode

Invalid PowerMode

Fields

§value: u8

Value

§

InvalidDiagnosticNackCode

Invalid DiagnosticNackCode

Fields

§value: u8

Value

§

InvalidDiagnosticAckCode

Invalid DiagnosticAckCode

Fields

§value: u8

Value

§

InvalidPayloadType

Invalid PayloadType

Fields

§value: [u8; 2]

Value

§

BufferTooSmall

When the destination buffer is too small

Fields

§size: usize

Size of the buffer

§

SliceError(TryFromSliceError)

Derived implementation for standard library IO errors

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, fmt: &mut Formatter<'_>) -> Result<(), Error>

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

impl From<TryFromSliceError> for Error

Source§

fn from(value: TryFromSliceError) -> Self

Converts to this type from the input type.

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<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> 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.