I just realized another shortcoming of the PinInterface
approach. It means users need to import the trait before using the corresponding functions. And it also separates the documentation of those functions from the Pin
and DynPin
documentation. For those reasons, I think using inherent functions is the better approach, even if it's more verbose.
If it is just about reducing duplicate code and avoiding to having update two structs everytime, a macro would probably solve this as well
Yeah, that's probably the best way to prevent code duplication in this specific case.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.