-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: feature-gated imports #110
base: master
Are you sure you want to change the base?
Conversation
itsyaasir
commented
Jul 8, 2024
- Update cached dependency to version 0.52
- Refactor client code to conditionally include openssl-related imports based on feature flags
- Move Invoice and InvoiceItem structs to bill_manager module
* Update cached dependency to version 0.52 * Refactor client code to conditionally include openssl-related imports based on feature flags * Move Invoice and InvoiceItem structs to bill_manager module
The code is starting to look ugly with all the feature gated things! we should come up with a way to clean this up. |
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.
A macro could be useful with the repetition to some extent
Doc tests need to be looked at separately, it's been a while.
#[cfg(any( | ||
feature = "account_balance", | ||
feature = "b2b", | ||
feature = "b2c", | ||
feature = "transaction_reversal", | ||
feature = "transaction_status" | ||
))] | ||
use openssl::base64; | ||
#[cfg(any( | ||
feature = "account_balance", | ||
feature = "b2b", | ||
feature = "b2c", | ||
feature = "transaction_reversal", | ||
feature = "transaction_status" | ||
))] | ||
use openssl::rsa::Padding; | ||
#[cfg(any( | ||
feature = "account_balance", | ||
feature = "b2b", | ||
feature = "b2c", | ||
feature = "transaction_reversal", | ||
feature = "transaction_status" | ||
))] | ||
use openssl::x509::X509; |
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.
This could be possible cleaned up by deriving a feature_locked!
(better name needed) declarative macro
#[cfg(any( | ||
feature = "account_balance", | ||
feature = "b2b", | ||
feature = "b2c", | ||
feature = "transaction_reversal", | ||
feature = "transaction_status" | ||
))] |
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.
same for this
|
||
#[derive(Debug, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct Invoice<'i> { |
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.
Ahh, I see you've moved this from the constants module to the bill manager module. This works as I don't think any other API (apart from bill manager) uses the invoice construct 👍