HaoYang670 opened a new pull request, #2439:
URL: https://github.com/apache/arrow-rs/pull/2439

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   # Rationale for this change
   The current implementation of `BasicDecimal` cannot restrict the 
`BYTE_WIDTH` to be 16 or 32, which means that you can create an invalid decimal 
value like this
   ```rust
   let v = BasicDecimal::<1>::new(1, 1, &[1]);
   ```
   
   # What changes are included in this PR?
   We create a new public trait `ValidDecimal` and implement the trait for 
`Decimal128` and `Decimal256`. The idea is from 
https://users.rust-lang.org/t/how-to-seal-the-const-generic/77947/2.
   Because of the orphan rule, downstream users cannot implement `ValidDecimal` 
for other `BasicDecimal` types.
   
   # Are there any user-facing changes?
   No breaking.
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   <!---
   If there are any breaking changes to public APIs, please add the `breaking 
change` label.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to