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

Digital v1 <-> v2 compatibility wrappers and shims #127

Merged
merged 11 commits into from
Mar 21, 2019

Conversation

ryankurte
Copy link
Contributor

@ryankurte ryankurte commented Feb 27, 2019

This PR introduces implicit v1 -> v2 (forward) compatibility, and explicit wrapper types for v2 -> v1 (reverse) compatibility between digital trait versions as a final step for #95, as well as moving the deprecated v1 traits to a re-exported module for clarity.

As @japaric pointed out, it is not feasible to have implicit compatibility in both directions, so it seemed reasonable to make regression explicit as it hides an .unwrap() on failure.

@therealprof, @hannobraun, @eldruin what do you think of this approach?
I think it probably needs more documentation, though I am definitely open to suggestions as to what / where.

See also: #100, #92, #102.

v1 -> v2 promotion now implicit, v2 -> v1 regression must be explicit with `.into()`
@rust-highfive
Copy link

r? @thejpster

(rust_highfive has picked a reviewer for you, use r? to override)

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

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

Great work @ryankurte! thank you for this. I added some comments below.

src/lib.rs Outdated Show resolved Hide resolved
src/digital/v1_compat.rs Outdated Show resolved Hide resolved
src/digital/v1_compat.rs Outdated Show resolved Hide resolved
src/digital/v1_compat.rs Outdated Show resolved Hide resolved
src/digital/v1_compat.rs Outdated Show resolved Hide resolved
src/digital/v1_compat.rs Outdated Show resolved Hide resolved
src/digital/v1_compat.rs Outdated Show resolved Hide resolved
src/digital/v2.rs Outdated Show resolved Hide resolved
src/digital/v2_compat.rs Show resolved Hide resolved
src/digital/v2_compat.rs Show resolved Hide resolved
@ryankurte
Copy link
Contributor Author

Thanks for all the feedback! I think I've resolved everything proposed.

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

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

Thanks @ryankurte!
I would say the remaining items as of now are:

  • Debug trait for error types
  • public inner method
  • maybe fewer #[cfg(feature = "unproven")] but this is just a small detail.

src/digital/v1_compat.rs Outdated Show resolved Hide resolved
@thejpster
Copy link
Contributor

Looks ok to me, but I'd like to hear more thoughts before merging.

@mathk mathk requested review from therealprof and japaric March 5, 2019 11:34
src/digital/mod.rs Outdated Show resolved Hide resolved
src/digital/v2.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

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

After addressing the two nits I just found this is okay for me. While I'm not super excited about the changes we really should get embedded-hal into motion again.

japaric
japaric previously approved these changes Mar 5, 2019
Copy link
Member

@japaric japaric left a comment

Choose a reason for hiding this comment

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

LGTM

Co-Authored-By: ryankurte <ryankurte@users.noreply.github.com>
@ryankurte ryankurte dismissed stale reviews from japaric via dbf815c March 5, 2019 18:53
@ryankurte ryankurte requested review from therealprof, japaric and hannobraun and removed request for japaric and hannobraun March 5, 2019 20:18
Copy link
Member

@japaric japaric left a comment

Choose a reason for hiding this comment

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

Still LGTM

@ryankurte ryankurte requested a review from a team March 10, 2019 22:40
@ryankurte
Copy link
Contributor Author

@thejpster are you happy that enough time has passed for people to raise any thoughts / issues?

@ryankurte
Copy link
Contributor Author

bors r=japaric

bors bot added a commit that referenced this pull request Mar 21, 2019
127: Digital v1 <-> v2 compatibility wrappers and shims r=japaric a=ryankurte

This PR introduces implicit  v1 -> v2 (forward) compatibility, and explicit wrapper types for v2 -> v1 (reverse) compatibility between digital trait versions as a final step for #95, as well as moving the deprecated v1 traits to a re-exported module for clarity.

As @japaric pointed out, it is not feasible to have implicit compatibility in both directions, so it seemed reasonable to make regression explicit as it hides an `.unwrap()` on failure.

@therealprof, @hannobraun, @eldruin what do you think of this approach?
I think it probably needs more documentation, though I am definitely open to suggestions as to what / where.

See also: #100, #92, #102.



Co-authored-by: Ryan Kurte <ryankurte@gmail.com>
Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
Co-authored-by: Daniel Egger <daniel@eggers-club.de>
@bors
Copy link
Contributor

bors bot commented Mar 21, 2019

Build succeeded

@bors bors bot merged commit dbf815c into rust-embedded:master Mar 21, 2019
@ryankurte ryankurte deleted the feature/digital-compat-shims-a branch March 22, 2019 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Review is incomplete T-hal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants