hal::error
One error type an application can ? into.
Every subsystem keeps its own small enum — a bus timeout is not a Wi-Fi
refusal, and a driver should say precisely what went wrong. But an
application that talks to three of them does not want three map_err
closures per function. [Error] is the sum of those enums, with a From
per subsystem so ? converts, plus the handful of failures that belong to
no subsystem in particular (NotInitialised, WrongDevice, …).
Drivers outside hal add impl From<TheirError> for hal::Error at the
bottom of their crate; a driver with nothing more specific to say maps to
[Error::Other] with a static message.
ConnectError
Section titled “ConnectError”enum ConnectError { Route, AlreadyRegistered, NoneFree,}Why a peripheral’s interrupt could not be delivered to a handler.
Returned by the kernel’s interrupt::connect; the enum lives here so a
driver can name it without naming the kernel.
Implements: Clone, Copy, Debug, Display, Eq, From, PartialEq, StructuralPartialEq
enum Error { Bus(crate::bus::BusError), Wifi(crate::wifi::WifiError), Dma(crate::dma::DmaError), Interrupt(ConnectError), NotInitialised, Unsupported, WrongDevice { expected: u8, found: u8 }, Other(&'static str),}The one error an application sees.
Implements: Clone, Copy, Debug, Display, Eq, From, PartialEq, StructuralPartialEq
References: BusError, ConnectError, DmaError, WifiError
Type Aliases
Section titled “Type Aliases”Result
Section titled “Result”type Result<T> = core::result::Result<T, Error>;A result whose error is [Error].
References: Error