bitcode
bitcode copied to clipboard
Fix #38 - support `rust_decimal`.
Fixes #38
Remaining questions:
- Is the
Flagsencoding maximally efficient?- justification of why it is: putting the sign bit at the LSB could help reduce the overall range of
u8values, allowing packing to work
- justification of why it is: putting the sign bit at the LSB could help reduce the overall range of
- 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)
Any update on this ? I would love to use this crate but I need rust decimal :)
Well, now there are two people who want it ;)
@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.
Thank you for this masterpiece
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
ConvertFromandimpl_convertwere exposed.
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.