Rename enum variants to Rust-friendly names #1154
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1095.
I think this is technically breaking, because you can
use
an enum's variant to bring it into scope, but this is not allowed for constants. So code that does this would break:Short of that, other cases should not be broken.EDIT: This was not possible forIndexConstraintOp
, since it had theSQLITE_INDEX_CONSTRAINT_FUNCTION
variant. I doubt many people use this, because we don't exposexFindFunction
, so I just renamed it.Other notes:
Cases which don't correspond to SQLite's constants (for example,
UNKNOWN
variants) are present as associated constants, but have had the capitalized versions deprecated, since the "compatibility with SQLite C API" argument doesn't hold. Some of these probably also should beTryFrom
impls rather thanFrom
.Some DbConfig values were gated on
feature = "modern_sqlite"
. This has been removed, in favor of noting that they will fail if you try to use it in an unsupported version. This is useful if you want to toggle the feature if it's supported, but do nothing if not. For example, it seems reasonable to allow code like the following:I only bothered with the value tests for cases where there were a large number of variants.
In several cases, I also tried to improve the docs.