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

remove trait bounds from sans-IO methods, for flexibility in extension crates #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danjl1100
Copy link

@danjl1100 danjl1100 commented Oct 2, 2023

Motivation

Libraries providing extensions traits for different devices using the ht16k33 (e.g. adafruit-7segment) become infected with HAL-specific trait bounds.

Solution

This PR moves the sans-IO methods to a separate impl block with no restriction on the I2C parameter (e.g. not tied to a specific HAL trait).

The thought being: if someone wants to use a different HAL, then they can patch only this crate ht16k33 and not every crate that extends its' functionality through data manipulation helpers. (e.g. patch ht16k33, and not both ht16k33 and adafruit-7segment)

The change is small (please check the diff of the "removed"/"added" sections), but let me know if you have any issues with merging this in.

NOTE: I left the new and destroy functions inside the HAL trait bounds (conservative approach) since the end user will still need to satisfying the trait bounds when constructing the display.

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.

None yet

1 participant