-
Notifications
You must be signed in to change notification settings - Fork 86
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
refactor: tidy up decimal
module
#294
base: main
Are you sure you want to change the base?
Conversation
…cimalExt::try_into_scalar_with_precision_and_scale`
…DecimalExt` trait and make it private
… into `DecimalError`
6af560f
to
f63ae2e
Compare
pub trait BigDecimalExt { | ||
fn precision(&self) -> u64; | ||
fn scale(&self) -> i64; | ||
fn try_into_bigint_with_precision_and_scale( | ||
/// Fallibly attempts to convert an `IntermediateDecimal` into the |
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 dont think we have the IntermediateDecimal type anymore?
#[derive(Eq, PartialEq, Debug, Clone, Hash, Serialize, Copy)] | ||
/// limit-enforced precision | ||
pub struct Precision(u8); | ||
pub(super) const MAX_SUPPORTED_PRECISION: u8 = 75; |
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 use a doc comment
}, | ||
} | ||
})?; | ||
let _max_precision = Precision::new(max_precision_value)?; |
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.
why is this unused? would it be better to have a check function that didnt require an unused variable?
Rationale for this change
After #283, the
math::decimal
module is a bit untidy, especially around error types and tests.What changes are included in this PR?
This reorganizes the module, tidies things up, and adds some more thorough unit tests.
Please look at the individual commits since there is a lot of code moved, and the individual commits are smaller than the aggregate.
Are these changes tested?
Yes