You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<cmr> Hm, this seems problematic. My serializer can't keep unbounded state, but I want to encode enum variant tags with the minimum amount of bytes necessary, using the same representation Rust does ideally. <cmr> The obvious approach of using a stack of recent total-number-of-variants is out, but I don't see how else it's possible. <cmr> (in fact, afaict, the serializer *never even has access* to that information, although the deserializer does.) <cmr> in the form of the len of the variants arg to deserialize_enum
@cmr I don't have the IRC logs but if I remember correctly, you realized that aiming for an encoding that is "at most as many bytes as Rust" was not feasible because of NonZero-related optimizations such as for Option<&T>, not to mention rust-lang/rfcs#1230. For just minimizing number of bytes, a variable-length encoding seems like it would be a better approach. The vast majority of enums will use 1 byte.
I am inclined to not make this change, rather than complicating the Serializer interface for this use case. What do you think?
From IRC:
cc @cmr
The text was updated successfully, but these errors were encountered: