pub enum ModbusError {
Show 16 variants
InvalidFunction(u8),
InvalidAddress {
address: u16,
max: u16,
},
InvalidQuantity {
quantity: u16,
max: u16,
},
InvalidData(String),
DeviceNotFound {
unit_id: u8,
},
Server(String),
Connection(String),
Io(Error),
Core(Error),
Internal(String),
InvalidUnitId {
unit_id: u8,
reason: String,
},
UnitNotFound {
unit_id: u8,
},
UnitAlreadyExists {
unit_id: u8,
},
UnitLimitReached {
max: usize,
},
UnitDisabled {
unit_id: u8,
},
Config(String),
}Expand description
Modbus error types.
Variants§
InvalidFunction(u8)
Invalid function code.
InvalidAddress
Invalid address.
InvalidQuantity
Invalid quantity.
InvalidData(String)
Invalid data.
DeviceNotFound
Device not found.
Server(String)
Server error.
Connection(String)
Connection error.
Io(Error)
I/O error.
Core(Error)
Core error.
Internal(String)
Internal error (for server implementation details).
InvalidUnitId
Invalid unit ID.
UnitNotFound
Unit not found.
UnitAlreadyExists
Unit already exists.
UnitLimitReached
Unit limit reached.
UnitDisabled
Unit disabled.
Config(String)
Configuration error.
Implementations§
Source§impl ModbusError
impl ModbusError
Sourcepub fn to_exception_code(&self) -> u8
pub fn to_exception_code(&self) -> u8
Convert to Modbus exception code.
Sourcepub fn invalid_address(address: u16, max: u16) -> Self
pub fn invalid_address(address: u16, max: u16) -> Self
Create an invalid address error.
Sourcepub fn invalid_quantity(quantity: u16, max: u16) -> Self
pub fn invalid_quantity(quantity: u16, max: u16) -> Self
Create an invalid quantity error.
Trait Implementations§
Source§impl Debug for ModbusError
impl Debug for ModbusError
Source§impl Display for ModbusError
impl Display for ModbusError
Source§impl Error for ModbusError
impl Error for ModbusError
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 From<Error> for ModbusError
impl From<Error> for ModbusError
Source§impl From<Error> for ModbusError
impl From<Error> for ModbusError
Source§impl From<ModbusError> for Error
impl From<ModbusError> for Error
Source§fn from(err: ModbusError) -> Self
fn from(err: ModbusError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ModbusError
impl !RefUnwindSafe for ModbusError
impl Send for ModbusError
impl Sync for ModbusError
impl Unpin for ModbusError
impl UnsafeUnpin for ModbusError
impl !UnwindSafe for ModbusError
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