-
Notifications
You must be signed in to change notification settings - Fork 546
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
Add support for some big number types #1014
Conversation
rust_decimal, bigdecimal and num-bigint are supported.
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 looks mostly OK to me.
@jaymell since these are separate crates, do you think that these should be added as a single feature, or split between multiple 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.
@jaymell LGMT, just not sure whether we want this as a single feature, or split the feature between crates, so that each bignum crate will have its own feature. WDYT?
This is great! But I definitely think it makes sense to not force everything into one feature. @AkiraMiyakoda Can we split this into multiple features, one for each external crate? |
Hi @jaymell |
Thanks for the contribution, and the excellent work! |
This PR enables
redis-rs
to read/write some third-party "big number" types directly.Motivation
We can store a number with any number of digits in Redis as a string. Although we can read such a value as a string and convert it into a desired numeric type, it's convenient when we can read it directly as a number like this:
This library already works with Rust's intrinsic numeric types. This PR adds a feature called
bignum
to it so that it can handle some 'big number' types from some third-party crates which are mature and widely used.What is this?
This PR contains
FromRedisValue
andToRedisArgs
implementation for following types:rust_decimal::Decimal
bigdecimal::BigDecimal
num_bigint::BigInt
num_bigint::BigUint
It includes tests and a feature flag as well.