pub enum Error<E> {
Transport(E),
InvalidIdentity {
devid_ad: u8,
devid_mst: u8,
partid: u8,
},
InvalidResponseLength {
register: u8,
expected: usize,
actual: usize,
},
InvalidState {
required: StateRequirement,
},
InvalidConfiguration {
register: u8,
value: u8,
},
NotReady,
Timeout,
Unsupported,
Restore(E),
}Expand description
Driver error with the underlying transport error preserved as E.
This type is allocation-free and remains usable in no_std builds. Match on
Error::Transport or Error::Restore to inspect and recover the original
bus/backend cause.
Variants§
Transport(E)
A read or write failed in the configured transport.
InvalidIdentity
Probe returned identity bytes that do not identify an ADXL355.
Fields
InvalidResponseLength
A transport returned a payload whose length violated the exact-length contract.
Fields
InvalidState
The device lifecycle does not permit the requested operation.
Fields
required: StateRequirementState that must be established before retrying.
InvalidConfiguration
A register value does not represent a supported configuration.
Fields
NotReady
Coherent data was not available within the driver’s bounded retry sequence.
Timeout
A bounded operation timed out.
Unsupported
The requested feature is not supported by this implementation.
Restore(E)
Restoring a previously active hardware state failed.
Implementations§
Source§impl<E> Error<E>
impl<E> Error<E>
Sourcepub fn transport_cause(&self) -> Option<&E>
pub fn transport_cause(&self) -> Option<&E>
Return the preserved transport cause when the error came from bus access.
Sourcepub const fn is_restore_failure(&self) -> bool
pub const fn is_restore_failure(&self) -> bool
Return true when the failure happened while restoring device state.
Trait Implementations§
impl<E: Eq> Eq for Error<E>
Source§impl<E> Error for Error<E>where
E: Error + 'static,
Available on crate feature std only.
impl<E> Error for Error<E>where
E: Error + 'static,
std only.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()