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
Hide public usages of bigdecimal::BigDecimal behind a crate feature #922
Conversation
I guess it would be useful for users who don't need
I don't think it's important right now. We can do this in the future when repetitions become problematic. |
It's not terribly difficult, but not simple either. I'm looking at the BigDecimal's implementation right now and it looks like you would have to implement some arithmetic on
As I wrote in review, I think we should consider dropping support for 0.2 and 0.3 for simplicity. I suspect that macros will not be necessary anymore after that. |
720aa50
to
bc66347
Compare
v2: addressed review comments, apart from the comment regarding removing support for |
By the way, you need to update |
bc66347
to
8150ad5
Compare
v3: removed support for bigdecimal v0.2 and v0.3 |
v4: updated Cargo.lock.msrv file |
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 think that in general bumping MSRV should be done in the same commit where Cargo.lock
is updated - technically speaking, the change is not bisectable under min_rust
job, but I really doubt that anybody will do something like that so that is a non-issue.
c51375c
to
bc1e92b
Compare
v5: addressed review comments |
Maybe it's not important for bisectability, but I'd still like those commits to be squashed. Updating Cargo.lock isn't an unrelated change in this case, it is a required change because of .toml modification. |
bc1e92b
to
2e4e9b3
Compare
v6: squashed |
2e4e9b3
to
9e7cdd1
Compare
v7: removed mention about bigdecimal v0.2 and v0.3 from the docs |
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.
One last thing - I don't think it fixes #771 entirely.
First and foremost, the chrono
, time
and secrecy
features enable dependencies that do not have stable releases, but their names do not have the version of those dependencies in them.
Second, the issue is not just about types used for serialization. We have other pre-1.0 dependencies which may prevent us from stabilizing the API:
histogram
- ourMetrics
type contains aHistogram
. We should not expose it publicly but rather reexport its functionality throughMetrics
' methods.num_enum
- it defines a bunch of traits and we implement them for some of our public types (andnum_enum::TryFromPrimitiveError
appears in ourFrameError
). We could easily implement the code that the crate generates automatically ourselves.openssl
- it's optional right now but the crates themselves are not stable. While those are only bindings to OpenSSL and are compatible with a wide range of versions (in case of OpenSSL they seem to be forwards-compatible), the openssl crate itself might turn out to have some security issues and maybe we will have to bump its version.strum
,strum_macros
- I believe they have a similar problem tonum_enum
and the solution is the same for them.async-trait
- we use it for some of our public traits (AddressTranslator
,AuthenticatorProvider
,AuthenticatorSession
). We may consider switching to recently stabilized async traits or change the methods to return boxed futures.
There were also some concerns about other, >=1.0 dependencies.
The PR description is also outdated |
Before this commit, we wouldn't check for the value overflow when computing the bigdecimal serialized bytes length. After this commit, we make use of explicit overflow checks before performing the addition.
9e7cdd1
to
10bd785
Compare
Refs: #771
Changes
value::CqlDecimal
typebigdecimal::Bigdecimal
behind crate feature.CqlDecimal
withCqlValue::Decimal
Points to discuss
PartialEq
forCqlDecimal
? Note thatCqlDecimal
makes use ofCqlVarint
, so the bytes normalization part can be delegated toCqlVarint
. However, there is an additional issue, because there are multiple pairs (integer, scale) which can represent the same number. Take for example:1e3
and100e1
. I don't think it's trivial to implement the comparison without converting bytes (hexadecimal representation) to decimal number.bigdecimal
crate that unfortunately cannot be expressed using some generic function (e.g. usages ofBigDecimal::new()
constructor).Pre-review checklist
./docs/source/
.Fixes:
annotations to PR description.