#[non_exhaustive]pub struct ModbusMessage {
pub transaction_id: u16,
pub unit_id: u8,
pub raw_function_code: u8,
pub function: ModbusFunction,
pub is_exception: bool,
pub exception_code: Option<ModbusExceptionCode>,
pub address: Option<u16>,
pub quantity: Option<u16>,
}modbus only.Expand description
One parsed Modbus/TCP frame.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.transaction_id: u16MBAP transaction identifier — pairs request with reply.
unit_id: u8Unit / server identifier (1-247 for normal servers, 0 broadcast, 255 gateway-bridge).
raw_function_code: u8Raw function code (1-127 normal, 129-255 exception).
function: ModbusFunctionDecoded function (vocabulary mapping; Other(n)
preserves any value the spec doesn’t enumerate).
is_exception: booltrue when the high bit of the function code was set
(server-side error response).
exception_code: Option<ModbusExceptionCode>For exception responses, the 1-byte exception code.
None otherwise.
address: Option<u16>Starting address / register address for read or write
requests (functions 1-4 + 5-6 + 15-16 + 23 covered).
None when the function doesn’t carry one.
quantity: Option<u16>Number of coils / registers being read/written, or
the value being written for single-coil/single-register
functions. None when not applicable.
Trait Implementations§
Source§impl Clone for ModbusMessage
impl Clone for ModbusMessage
Source§impl Debug for ModbusMessage
impl Debug for ModbusMessage
Source§impl<'de> Deserialize<'de> for ModbusMessage
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ModbusMessage
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ModbusMessage
Source§impl PartialEq for ModbusMessage
impl PartialEq for ModbusMessage
Source§impl Serialize for ModbusMessage
Available on crate feature serde only.
impl Serialize for ModbusMessage
serde only.impl StructuralPartialEq for ModbusMessage
Auto Trait Implementations§
impl Freeze for ModbusMessage
impl RefUnwindSafe for ModbusMessage
impl Send for ModbusMessage
impl Sync for ModbusMessage
impl Unpin for ModbusMessage
impl UnsafeUnpin for ModbusMessage
impl UnwindSafe for ModbusMessage
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.