Skip to content

Conversation

@bugadani
Copy link
Contributor

  • RTCPin now extends Pin
  • Pin is now object-safe

This change allows, for example, reading a pin's pin_number when one only has a &dyn RTCPin.

@bugadani
Copy link
Contributor Author

bugadani commented Jul 26, 2023

To be honest, I'm not a big fan of the Pin trait, or at least I'm not married to the idea of making it object-safe. All I need is the pin_number from it, so generating a big vtable with all the other functions is probably just wasteful. I'm considering adding pin_number to RTCPin instead, or extracting a PinNumber trait, but I'm also open to other suggestions.

Eh, unless I messed up my trial, there is only a 1kB code size difference, so probably not worth the faff.

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Given that we weren't using the resultant &mut Self for chaining anywhere, I think this is a perfectly fine change.

@MabezDev MabezDev merged commit fedd2ad into esp-rs:main Jul 28, 2023
@bugadani bugadani deleted the objsafe branch July 28, 2023 11:00
playfulFence pushed a commit to playfulFence/esp-hal that referenced this pull request Sep 26, 2023
* Make Pin a supertrait

* Make Pin object-safe

* Add to changelog
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