dashu icon indicating copy to clipboard operation
dashu copied to clipboard

Improve support for third-party crates

Open cmpute opened this issue 2 years ago • 2 comments

  • [x] Support rand for FBig and RBig
  • [x] Support num-traits for FBig and RBig
    • [x] Zero, One, FromPrimitive, ToPrimitive, Num
    • [x] Euclid, Pow
  • [x] Support zeroize for FBig and RBig
  • [x] Support serde for FBig and RBig
    • Support the is_human_readable option (see https://github.com/rust-num/num-rational/issues/90)
    • Serialize to compact binary representation if is_human_readable=false, serialize all to string if is_human_readable=true
    • Improve efficiency of serialized IBig by store the sign bit in the LSB of the highest word (by always shifting the highest word left by 1). This is the zigzag encoding used by postcard.
  • [ ] Support rkyv for UBig, IBig, FBig and RBig, try to do zero-copying serialization in this framework.
  • [ ] Support arbitrary::Arbitrary or quickcheck::Arbitrary for UBig, IBig, FBig and RBig
  • [x] Support postgres decimal through sqlx, postgres, tokio-postgres or diesel crates (see fraction and rust_decimal crates)
  • [ ] ~~Support pyo3 conversion~~
    • [ ] ~~Convert UBig and IBig to native Python int~~
    • [ ] ~~Convert DBig to Python decimal~~
    • [ ] ~~Convert RBig and Relaxed to Python fractions~~
    • [ ] ~~Convert FBig to native python float (double)~~

cmpute avatar Nov 15 '22 20:11 cmpute

Some crates that are related but not yet in the plan to support:

  • rust_decimal
  • half

cmpute avatar Dec 03 '22 01:12 cmpute

The support for PyO3 will be postponed, as PyO3 is being actively refactored.

cmpute avatar Jan 27 '24 16:01 cmpute