slowtec / modbus-core

A pure no-std Rust modbus library
Apache License 2.0
40 stars 16 forks source link

Export codec module #1

Closed FrozenDroid closed 3 months ago

FrozenDroid commented 5 years ago

Is there a reason the codec module isn't being exported? Right now, the encoding trait isn't available.

flosse commented 5 years ago

Is there a reason the codec module isn't being exported?

no, not really. The modbus-core crate is still in a proof-of-concept state but we'll definitely use it as a base for tokio-modbus in the future. Without any guarantee I think at the end of the year we can release a first version. You are very welcome to join the development :) So feel free to make suggestions or even create tests & pull requests :)

FrozenDroid commented 5 years ago

Ok cool, will do. I also saw that the encoder for Request doesn't add in the CRC and slave ID. Is there something planned for that or should I implement this?

flosse commented 5 years ago

I also saw that the encoder for Request doesn't add in the CRC and slave ID. Is there something planned for that

Yes, it's planned but as I already mentioned the crate is not finished yet ;-)

or should I implement this?

That would be cool! :+1: And don't hesitate to ask for help if you have further questions :)

FrozenDroid commented 5 years ago

Awesome :) I'll hopefully have time later this week to work on the crate a bit. Maybe I should make a new issue for it, but I think it would be nice to construct the buffers we need within the library, with sizes known at compile-time using const-generics. For my usecase (embedded, thus no-std) I need to create arrays with a fixed size already.

Const-generics are currently still nightly, but it's something that I would very much like to use.

flosse commented 5 years ago

Awesome :) I'll hopefully have time later this week to work on the crate a bit.

:+1:

Maybe I should make a new issue for it, but I think it would be nice to construct the buffers we need within the library, with sizes known at compile-time using const-generics.

I'm happy to see your solution :)

For my usecase (embedded, thus no-std) I need to create arrays with a fixed size already.

I had the same usecase, I implemented a simple modbus server on a STM32. I did a lot manually but I agree that we should offer some convenient utilities within the crate.

Const-generics are currently still nightly, but it's something that I would very much like to use.

We try to keep our libraries compatible with stable Rust but maybe we can add a nightly feature flag to optionally enable functionalities.