OutputStateError

Enum OutputStateError 

Source
pub enum OutputStateError<I, E> {
    InputPinError(I),
    EnablePinError(E),
    NotEnabled,
}
Expand description

Error returned by the L293x and HalfH implementations.

This enumeration combines the possible errors returned by the input pin and the enable pin.

Depending on the source of the error, either an InputPinError or a EnablePinError will be returned by the functions implemented in the OutputPin traits.

§Examples

use embedded_hal::digital::OutputPin;
use l293x::{HalfH, OutputStateError};

let mut bridge = HalfH::new(input, enable);

bridge.set_high().unwrap_or(|error| {
    match error {
        OutputStateError::InputPinError(e) => println!("Error setting the input pin high: {e}"),
        OutputStateError::EnablePinError(e) => println!("Error in enable pin: {e}"),
    }
});

Variants§

§

InputPinError(I)

An error occurred while setting the state of the input pin. The contained error

§

EnablePinError(E)

An error occurred while setting the state of the enable pin. The contained error may contain additional information.

§

NotEnabled

Error returned by the is_set_[high|low] methods of the StatefulOutputPin trait, if the output checked is not enabled.

Trait Implementations§

Source§

impl<I: Debug, E: Debug> Debug for OutputStateError<I, E>

Source§

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

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

impl<I, E> Error for OutputStateError<I, E>
where I: Error, E: Error,

Source§

fn kind(&self) -> ErrorKind

Convert error to a generic error kind Read more
Source§

impl<I, E> Error for OutputStateError<I, E>
where I: Error, E: Debug,

Source§

fn kind(&self) -> ErrorKind

Convert error to a generic error kind. Read more
Source§

impl<I, E> PartialEq for OutputStateError<I, E>
where I: PartialEq, E: PartialEq,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I, E> Eq for OutputStateError<I, E>
where I: Eq, E: Eq,

Auto Trait Implementations§

§

impl<I, E> Freeze for OutputStateError<I, E>
where I: Freeze, E: Freeze,

§

impl<I, E> RefUnwindSafe for OutputStateError<I, E>

§

impl<I, E> Send for OutputStateError<I, E>
where I: Send, E: Send,

§

impl<I, E> Sync for OutputStateError<I, E>
where I: Sync, E: Sync,

§

impl<I, E> Unpin for OutputStateError<I, E>
where I: Unpin, E: Unpin,

§

impl<I, E> UnwindSafe for OutputStateError<I, E>
where I: UnwindSafe, E: UnwindSafe,

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