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

Replace custom error type in favour of Debug constraints #10

Merged
merged 1 commit into from
Mar 10, 2020
Merged

Conversation

wezm
Copy link
Owner

@wezm wezm commented Mar 10, 2020

@etrombly I came up with this to avoid the need for the error type. It seems the v1/v2 GPIO traits are a bit of a mess. There some discussion on the embedded-hal repo about a v3 that would address some of the issues like we're seeing here. Hopefully that will get sorted eventually and we can move to that.

@codecov-io
Copy link

codecov-io commented Mar 10, 2020

Codecov Report

Merging #10 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #10   +/-   ##
=======================================
  Coverage   92.14%   92.14%           
=======================================
  Files           4        4           
  Lines         191      191           
=======================================
  Hits          176      176           
  Misses         15       15

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d8b68d...f27c2c6. Read the comment docs.

@etrombly
Copy link
Contributor

looks a lot cleaner than what I came up with. I think the linux traits may be able to fail, so at some point you may want to handle the errors. I use mostly stm32, so this works well for me.

@wezm
Copy link
Owner Author

wezm commented Mar 10, 2020

I think the linux traits may be able to fail, so at some point you may want to handle the errors.

Yes this is true. My first attempt was to extend your error type so it could hold an SPI error and a GPIO error and then add From impls for it. The generics make it really awkward though.

Since this is effectively how it worked with the v1 traits I'm not too fussed. I've subscribed to that v3 issue and hopefully they come up with something that's a bit nice to use.

@wezm wezm merged commit f46fcbd into master Mar 10, 2020
@wezm wezm deleted the gpio-errors branch March 10, 2020 22:32
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.

3 participants