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
our main usecase is adding new fields to a structure in a backwards-compatible way. I attempted to implement this manually by just reading more bytes and using the default if it fails due to hitting the end of the stream, but this of course doesn't work since bincode doesn't have any notion of "structs" (if the struct with this manual implementation is nested with another struct, it will read into the following field of the parent struct). I don't think there's a clean way around this, and likely we'll end up versioning our types at the top level with a large enum a la enum Type { V1(TypeV1), V2(TypeV2) }.
The best way we've found is to indeed do enum Type { V1(TypeV1), V2(TypeV2) } or to append an Option<()> to each struct. We know there's a desire to have backward compatibility for bincode, but we also have no way to implement this technically with how bincode is set up.
It is possible to have any functionality similar to
#[serde(default)]
?The text was updated successfully, but these errors were encountered: