tokio-modbus
tokio-modbus copied to clipboard
How to convert tokio_modbus::Request to bytes?
The tokio_modbus::Request has TryFrom<Bytes> function, how to convert from Request to Bytes? just like impl into<Bytes> for tokio_modbus::Request.
Please describe your use case.
In my case, there is an endpoint that needs to add a data header to the modbus data and send it to it, which needs to be encapsulated using the modbus request data.
We currently don't expose the low-level encoding/decoding of Modbus protocol messages at the API.
Implementing the public From/TryFrom traits that leak into the public API instead of using private functions was probably inappropriate and leads to those false expectations.
Oh, I known. Is there any other way to get modbus data? Or tokio_modbus::Request a logical reference for assembling modbus data?
This would require to extract the lower level code, preferably as a standalone crate: #22