-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does adding an enum variant break backwards compat? #16
Comments
Hello, If you use the If you use the derive version ( |
That's great to know, thanks! Can this (and anything else compatibility related) be documented? Happy to close this issue, but it'd be nice to have this stuff in the readme and crate docs. |
Actually, can I turn this into a feature request? I'd like to be able to specify the number of bits to reserve for an enum so I can choose how many I want to have for future compat. Really the setting should be "number of available variants" and in the backend it rounds up to a power of two or does something smarter. |
This is not a "feature" we want to advertise. (the existence of this issue - even after it is closed - serves as a small amount of searchable documentation, which is probably enough)
Unfortunately the ability to reserve |
This is what should be documented then. Also when you say versions, you mean major versions right? |
Yes, e.g. |
Also, I talked with @caibear and another workaround (for #[derive(Encode, Decode)]
enum Extensible {
A,
B(String),
#[doc(hidden)]
Placeholder1,
#[doc(hidden)]
Placeholder2,
} Then, as long as you never use the placeholders, you can change their definition to be a tuple or struct variant. |
Clever!
Is this guaranteed to always work? If so, that's good enough for me. |
Probably, unless we need to deprecate it in a major version (in which case you would have to break compatibility anyway by upgrading if you needed to upgrade). |
That's fine, thanks! |
I just want to confirm: anything written as type
A
will be incompatible for reading as if it were typeA'
? Specifically for enum variants.The text was updated successfully, but these errors were encountered: