Struct tokio_modbus::slave::Slave
source · pub struct Slave(pub SlaveId);
Expand description
A single byte for addressing Modbus slave devices.
Tuple Fields§
§0: SlaveId
Implementations§
source§impl Slave
impl Slave
sourcepub const fn broadcast() -> Self
pub const fn broadcast() -> Self
The special address for sending a broadcast message to all connected Modbus slave devices at once. Broadcast messages are one-way and sent from the master to all slaves, i.e. a request without a response.
Some devices may use a custom id from the reserved range 248-255 for broadcasting.
sourcepub const fn min_device() -> Self
pub const fn min_device() -> Self
The minimum address of a single Modbus slave device.
sourcepub const fn max_device() -> Self
pub const fn max_device() -> Self
The maximum address of a single Modbus slave device.
sourcepub const fn tcp_device() -> Self
pub const fn tcp_device() -> Self
The reserved address for sending a message to a directly connected Modbus TCP device, i.e. if not forwarded through a TCP/RTU gateway according to the unit identifier.
Modbus Messaging on TCP/IP Implementation Guide, page 23 “On TCP/IP, the Modbus server is addressed using its IP address; therefore, the Modbus Unit Identifier is useless. The value 0xFF has to be used.”
sourcepub fn is_broadcast(self) -> bool
pub fn is_broadcast(self) -> bool
Check if the SlaveId
is used for broadcasting
sourcepub fn is_single_device(self) -> bool
pub fn is_single_device(self) -> bool
Check if the SlaveId
addresses a single device
sourcepub fn is_reserved(self) -> bool
pub fn is_reserved(self) -> bool
Check if the SlaveId
is reserved
Trait Implementations§
source§impl Ord for Slave
impl Ord for Slave
source§impl PartialEq for Slave
impl PartialEq for Slave
source§impl PartialOrd for Slave
impl PartialOrd for Slave
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more