Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to convert tokio_modbus::Request to bytes? #201

Open
cppcoffee opened this issue Jun 19, 2023 · 5 comments
Open

How to convert tokio_modbus::Request to bytes? #201

cppcoffee opened this issue Jun 19, 2023 · 5 comments
Labels

Comments

@cppcoffee
Copy link

cppcoffee commented Jun 19, 2023

The tokio_modbus::Request has TryFrom<Bytes> function, how to convert from Request to Bytes? just like impl into<Bytes> for tokio_modbus::Request.

@uklotzde
Copy link
Member

uklotzde commented Jun 19, 2023

Please describe your use case.

@cppcoffee
Copy link
Author

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.

@uklotzde
Copy link
Member

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.

@cppcoffee
Copy link
Author

Oh, I known. Is there any other way to get modbus data? Or tokio_modbus::Request a logical reference for assembling modbus data?

@uklotzde
Copy link
Member

This would require to extract the lower level code, preferably as a standalone crate: #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants