pub enum DriverError<E> {
Bus(E),
Sensor(SensorError),
Timeout,
}Expand description
What can go wrong driving a part over a bus, beyond decoding its bytes.
A driver returns this from every transfer sequence. It converts into the core
Error so a driver used as a
Sensor reports the way every other device does: a bus
fault and a timeout become Error::Io, a checksum or an
undefined field become Error::Codec, and a part
that identifies as something else becomes Error::Io.
Variants§
Bus(E)
The bus underneath the driver failed: a missing acknowledge, a bus fault, a pin that could not be driven.
Sensor(SensorError)
The part’s bytes decoded to something its datasheet rules out.
Timeout
The part did not finish within the time its datasheet allows, so its data registers never became ready.
Trait Implementations§
Source§impl<E: Clone> Clone for DriverError<E>
impl<E: Clone> Clone for DriverError<E>
Source§fn clone(&self) -> DriverError<E>
fn clone(&self) -> DriverError<E>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<E: Copy> Copy for DriverError<E>
Source§impl<E: Debug> Debug for DriverError<E>
impl<E: Debug> Debug for DriverError<E>
Source§impl<E: Debug> Display for DriverError<E>
Available on crate feature embedded-hal only.
impl<E: Debug> Display for DriverError<E>
Available on crate feature
embedded-hal only.impl<E: Eq> Eq for DriverError<E>
Source§impl<E: Debug> Error for DriverError<E>
Available on crate feature embedded-hal only.
impl<E: Debug> Error for DriverError<E>
Available on crate feature
embedded-hal only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl<E: Debug> From<DriverError<E>> for Error
Available on crate feature embedded-hal only.
impl<E: Debug> From<DriverError<E>> for Error
Available on crate feature
embedded-hal only.Source§fn from(error: DriverError<E>) -> Self
fn from(error: DriverError<E>) -> Self
Converts to this type from the input type.
Source§impl<E> From<SensorError> for DriverError<E>
Available on crate feature embedded-hal only.
impl<E> From<SensorError> for DriverError<E>
Available on crate feature
embedded-hal only.Source§fn from(error: SensorError) -> Self
fn from(error: SensorError) -> Self
Converts to this type from the input type.
Source§impl<E: PartialEq> PartialEq for DriverError<E>
impl<E: PartialEq> PartialEq for DriverError<E>
impl<E: PartialEq> StructuralPartialEq for DriverError<E>
Auto Trait Implementations§
impl<E> Freeze for DriverError<E>where
E: Freeze,
impl<E> RefUnwindSafe for DriverError<E>where
E: RefUnwindSafe,
impl<E> Send for DriverError<E>where
E: Send,
impl<E> Sync for DriverError<E>where
E: Sync,
impl<E> Unpin for DriverError<E>where
E: Unpin,
impl<E> UnsafeUnpin for DriverError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for DriverError<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more