bitcode icon indicating copy to clipboard operation
bitcode copied to clipboard

Fix #38 - support `rust_decimal`.

Open finnbear opened this issue 1 year ago • 1 comments

Fixes #38

finnbear avatar Sep 20 '24 01:09 finnbear

Remaining questions:

  • Is the Flags encoding maximally efficient?
    • justification of why it is: putting the sign bit at the LSB could help reduce the overall range of u8 values, allowing packing to work
  • Do all numbers round-trip properly?
    • [x] need to check non-normalized decimal (with trailing zeroes)
    • [x] strongly suspect -0 would be converted to 0 upon decoding (I want to fix this)

finnbear avatar Sep 23 '24 22:09 finnbear

Any update on this ? I would love to use this crate but I need rust decimal :)

SharksT avatar May 14 '25 12:05 SharksT

Well, now there are two people who want it ;)

finnbear avatar May 14 '25 12:05 finnbear

@finnbear Maybe there are many, many people who want this. Perhaps precisely because their business now relies on rust_decimal, they currently cannot introduce bitcode.

Don't let it gather dust—merge it and let it shine! And also for uuid.

image

Thank you for this masterpiece

l-7-l avatar Aug 12 '25 03:08 l-7-l

Before merging, I think we should

  • Avoid any unsafe code in the rust_decimal.rs file. It's not maintainable for us to add new unsafe code for each library that gets added.
  • Consider the Pros/Cons of this custom implementation vs a much simpler https://docs.rs/rust_decimal/latest/rust_decimal/struct.Decimal.html#method.serialize
  • These 2 ensure that the implementation doesn't use bitcode internals and could exist outside bitcode if ConvertFrom and impl_convert were exposed.

caibear avatar Aug 12 '25 22:08 caibear

Also I noticed that rkyv and borsh serialization avoids validating anything about the Decimal. I want to get the opinion of the rust_decimal maintainers if this is a bug or allows faster deserialization.

caibear avatar Aug 12 '25 22:08 caibear