Enum contec_protocol::Error
source · [−]pub enum Error<E: AsErrorSource> {
DeviceIOError {
source: E,
},
DeviceWriteZero,
DeviceWriteTooMuch {
requested: usize,
reported: usize,
},
DeviceReadZero,
DeviceReadTooMuch {
requested: usize,
reported: usize,
},
InvalidPackageData {
code: u8,
bytes: [u8; 8],
length: usize,
invalid_index: usize,
},
UnknownTypeCode {
code: u8,
},
}
Expand description
A specialized Error
type that provides device communication error information.
Variants
DeviceIOError
communicating with the device failed
DeviceWriteZero
device reported 0
bytes written
DeviceWriteTooMuch
devices reported more bytes written than requested
DeviceReadZero
device reported ‘0’ bytes read
DeviceReadTooMuch
devices reported more bytes read than requested
InvalidPackageData
Fields
code: u8
package type code
length: usize
package length
invalid_index: usize
index of first invalid byte
invalid package
UnknownTypeCode
Fields
code: u8
unknown type code
unexpected package type code encountered
Trait Implementations
sourceimpl<E: Debug + AsErrorSource> Debug for Error<E>
impl<E: Debug + AsErrorSource> Debug for Error<E>
sourceimpl<E: AsErrorSource> Display for Error<E>
impl<E: AsErrorSource> Display for Error<E>
sourceimpl<E: AsErrorSource> Error for Error<E> where
Self: Debug + Display,
impl<E: AsErrorSource> Error for Error<E> where
Self: Debug + Display,
sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourcefn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
replaced by Error::source, which can support downcasting
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourceimpl<E: AsErrorSource> ErrorCompat for Error<E>
impl<E: AsErrorSource> ErrorCompat for Error<E>
sourcefn iter_chain(&self) -> ChainCompat<'_> where
Self: AsErrorSource,
fn iter_chain(&self) -> ChainCompat<'_> where
Self: AsErrorSource,
Returns an iterator for traversing the chain of errors,
starting with the current error
and continuing with recursive calls to Error::source
. Read more
Auto Trait Implementations
impl<E> RefUnwindSafe for Error<E> where
E: RefUnwindSafe,
impl<E> Send for Error<E> where
E: Send,
impl<E> Sync for Error<E> where
E: Sync,
impl<E> Unpin for Error<E> where
E: Unpin,
impl<E> UnwindSafe for Error<E> where
E: UnwindSafe,
Blanket Implementations
sourceimpl<T> AsErrorSource for T where
T: 'static + Error,
impl<T> AsErrorSource for T where
T: 'static + Error,
sourcefn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
For maximum effectiveness, this needs to be called as a method to benefit from Rust’s automatic dereferencing of method receivers. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more