pub enum DataError {
ValueOutOfRange {
parameter: &'static str,
min: u16,
max: u16,
unit: &'static str,
},
UseDefaultPressure,
CrcFailed,
ReceivedBufferWrongSize,
UnexpectedValueReceived {
parameter: &'static str,
expected: &'static str,
actual: u16,
},
}
Expand description
Error variants handling data errors.
Variants§
ValueOutOfRange
Emitted when a value is used to construct data send to the sensor, but the value is not in the specified value’s range. Adjust the argument to a value within the specified bounds.
Fields
UseDefaultPressure
Emitted when the ambient pressure compensation is set to 0. Use either no value or the DefaultPressure enum variant.
CrcFailed
Emitted when the CRC check for received data fails.
ReceivedBufferWrongSize
Emitted when data received does not match the expected data size.
UnexpectedValueReceived
Emitted when a enum value received is not within the expected value range. Could occur if the firmware of the sensor has received updates.
Trait Implementations§
Source§impl Error for DataError
impl Error for DataError
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()
impl StructuralPartialEq for DataError
Auto Trait Implementations§
impl Freeze for DataError
impl RefUnwindSafe for DataError
impl Send for DataError
impl Sync for DataError
impl Unpin for DataError
impl UnwindSafe for DataError
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