-
Notifications
You must be signed in to change notification settings - Fork 51
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
Use traits to define common backend interface #196
Conversation
I see some tests are failing since an indirect dev-dependency requires Rust 1.70... not sure what we want to do there. Though that's unrelated to this change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move the backends into a separate directory now, since there are other non-backend files in the root of the crate.
Aside from that, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Would love to get rid of the macro, but didn't look into it to offer any suggestions.
I second #196 (review) suggestion, but I'm happy to approve it as is.
The alternative to the macro would be I think the |
Rebase on master for fixed MSRV CI |
This still uses enums to dispatch to the backends, but has the `*Dispatch` types implement the same traits. Nothing about the behavior or performance should change. If we require backends to implement the same methods, it seems good to use traits for that. Any documentation on the interface implemented by backends can be in one place. The traits can provide default implementations where appropriate. Hopefully this will help with more refactoring and features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I maintain my earlier comment about the separate directory. I would move cg.rs
, kms.rs
, etc into a separate sys
module to separate them from the new ones.
Fixes build warnings on some platforms.
Now `lib.rs` doesn't need conditional code and macros for dispatching `new`. It can be handled by `make_dispatch!`.
Added fixes for (unrelated) CI issues, and moved the backends to a |
Added a commit that move the backend context/surface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This still uses enums to dispatch to the backends, but has the
*Dispatch
types implement the same traits. Nothing about the behavior or performance should change.If we require backends to implement the same methods, it seems good to use traits for that. Any documentation on the interface implemented by backends can be in one place. The traits can provide default implementations where appropriate.
Hopefully this will help with more refactoring and features.