Skip to content

Conversation

@Abestanis
Copy link
Contributor

I have a usecase where I have an iterator that produces coils, and I want to avoid creating a temporary buffer when constructing the Coils object for a response.

To archive this, I had to change modbus_core::pack_coils to also accept an iterator, and I needed it to return the number of coils, not the number of bytes. Since the previous return type was the number of bytes as a usize, instead of using a usize to represent the number of coils (thus potentially silently breaking code) I added a new type CoilQuantity that makes it clear what the number is used for.

Copy link
Member

@flosse flosse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@flosse flosse merged commit 6955cce into slowtec:master Oct 6, 2025
4 checks passed
@Abestanis Abestanis deleted the feature/from_iter branch October 6, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants