Skip to content

Remove blanket impl for &mut T and add wrapper macro#34

Merged
tullom merged 1 commit intoOpenDevicePartnership:mainfrom
tullom:remove-impl-for-mutT-and-add-wrapper-macro
Jan 5, 2026
Merged

Remove blanket impl for &mut T and add wrapper macro#34
tullom merged 1 commit intoOpenDevicePartnership:mainfrom
tullom:remove-impl-for-mutT-and-add-wrapper-macro

Conversation

@tullom
Copy link
Contributor

@tullom tullom commented Dec 23, 2025

  • Types that wrap an object that implements SmartBattery are common, and having to impl SmartBattery for the wrapper results in lots of boilerplate. This change adds a macro to reduce boilerplate.
  • Uprev to v0.3.0

Resolves #26

@tullom tullom self-assigned this Dec 23, 2025
@tullom tullom requested a review from a team as a code owner December 23, 2025 06:03
@tullom tullom added the enhancement New feature or request label Dec 23, 2025
- Types that wrap an object that implements SmartBattery are common, and having to impl SmartBattery for the wrapper results in lots of boilerplate. This change adds a macro to reduce boilerplate.
@tullom tullom force-pushed the remove-impl-for-mutT-and-add-wrapper-macro branch from ca429ca to 72d5fec Compare December 23, 2025 06:05
@tullom tullom moved this to In review in ODP Backlog Dec 23, 2025
@RobertZ2011
Copy link
Contributor

Long-term we should refactor the code so that we don't have to explicitly implement traits for &mut T but I fine with this change going in for now.

@tullom
Copy link
Contributor Author

tullom commented Jan 5, 2026

Long-term we should refactor the code so that we don't have to explicitly implement traits for &mut T but I fine with this change going in for now.

The trait methods all take in a mutable reference to T so technically downstream users will never have to implement the trait for &mut T assuming the trait is implemented for T. (I could be wrong but that's my understanding of these blanked impls for &mut T, it was never needed to begin with).

@tullom tullom merged commit 9fb4fe5 into OpenDevicePartnership:main Jan 5, 2026
29 of 44 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in ODP Backlog Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Remove blanket implementation for &mut T in SmartBattery and Charger traits

3 participants