icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Always use discriminant in ZeroTrie Serde; use serialize_bytes consistently

Open sffc opened this issue 1 year ago • 2 comments

Fixes #4562

There are diffs; good to get this into 1.5

sffc avatar May 24 '24 01:05 sffc

I scope-creeped a little bit and added more rmp-serde tests. I eyeballed all the custom Serialize impls in the project and added some tests on ones that looked important or suspicious. I found and fixed 1 other instance where we were using serialize_seq with deserialize_bytes.

sffc avatar May 25 '24 06:05 sffc

Note: if you don't want me to serialize the whole thing as bytes, one potential alternative is that I could serialize a single u8 followed by bytes.

sffc avatar May 25 '24 06:05 sffc

Note: if you don't want me to serialize the whole thing as bytes, one potential alternative is that I could serialize a single u8 followed by bytes.

^ Do you think doing it this way, with a separate entry encoding the discriminant, might be superior?

sffc avatar May 28 '24 08:05 sffc

Yes I think it would be.

robertbastian avatar May 28 '24 08:05 robertbastian

Ok coming right up

sffc avatar May 28 '24 08:05 sffc

ok I have it implemented, but there's a stable key time_zone/iana_to_bcp47@1 that uses ZeroTrie and therefore the old format. I want to get rid of ZeroTrie and stick with just the variants (#4408) so I'm inclined to still use the new serialization format for the variants if we think it's superior.

sffc avatar May 28 '24 09:05 sffc