pub struct ModbusProcessor { /* private fields */ }
Implementations§
Source§impl ModbusProcessor
impl ModbusProcessor
pub fn new(transport: Arc<RtuTransport>) -> Self
Sourcepub async fn process_request(
&self,
transaction_id: [u8; 2],
unit_id: u8,
pdu: &[u8],
) -> Result<Vec<u8>, RelayError>
pub async fn process_request( &self, transaction_id: [u8; 2], unit_id: u8, pdu: &[u8], ) -> Result<Vec<u8>, RelayError>
Processes a Modbus TCP request by converting it to Modbus RTU, sending it over the transport, and then converting the RTU response back to Modbus TCP format.
§Arguments
transaction_id
- The Modbus TCP transaction ID.unit_id
- The Modbus unit ID (slave address).pdu
- The Protocol Data Unit from the Modbus TCP request.
§Returns
A Result
containing the Modbus TCP response as a vector of bytes, or a RelayError
.
Auto Trait Implementations§
impl Freeze for ModbusProcessor
impl !RefUnwindSafe for ModbusProcessor
impl Send for ModbusProcessor
impl Sync for ModbusProcessor
impl Unpin for ModbusProcessor
impl !UnwindSafe for ModbusProcessor
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