pub struct ModbusDeviceConfig {
pub unit_id: u8,
pub name: String,
pub coils: u16,
pub discrete_inputs: u16,
pub holding_registers: u16,
pub input_registers: u16,
pub response_delay_ms: u64,
pub tags: Tags,
}Expand description
Modbus device configuration.
Fields§
§unit_id: u8Unit ID (1-247).
name: StringDevice name.
coils: u16Number of coils.
discrete_inputs: u16Number of discrete inputs.
holding_registers: u16Number of holding registers.
input_registers: u16Number of input registers.
response_delay_ms: u64Response delay in milliseconds (for simulation).
Device tags for organization and filtering.
Implementations§
Source§impl ModbusDeviceConfig
impl ModbusDeviceConfig
Sourcepub fn new(unit_id: u8, name: impl Into<String>) -> Self
pub fn new(unit_id: u8, name: impl Into<String>) -> Self
Create a new device config with the specified unit ID.
Sourcepub fn with_response_delay(self, delay_ms: u64) -> Self
pub fn with_response_delay(self, delay_ms: u64) -> Self
Set response delay.
Set tags.
Sourcepub fn with_tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a single tag.
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Add a label.
Trait Implementations§
Source§impl Clone for ModbusDeviceConfig
impl Clone for ModbusDeviceConfig
Source§fn clone(&self) -> ModbusDeviceConfig
fn clone(&self) -> ModbusDeviceConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModbusDeviceConfig
impl Debug for ModbusDeviceConfig
Source§impl Default for ModbusDeviceConfig
impl Default for ModbusDeviceConfig
Source§impl<'de> Deserialize<'de> for ModbusDeviceConfig
impl<'de> Deserialize<'de> for ModbusDeviceConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ModbusDeviceConfig
impl RefUnwindSafe for ModbusDeviceConfig
impl Send for ModbusDeviceConfig
impl Sync for ModbusDeviceConfig
impl Unpin for ModbusDeviceConfig
impl UnsafeUnpin for ModbusDeviceConfig
impl UnwindSafe for ModbusDeviceConfig
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