const-oid: make ObjectIdentifier's size const generic#1300
Merged
Conversation
Previously the v0.10-pre release series has attempted to make `ObjectIdentifier` generic around a backing buffer containing the BER encoding and bounded on `AsRef<[u8]>`. This approach has a drawback though: we can't use derived `PartialEq`/`Eq`, which means it isn't possible to use in `match` expressions anymore, an ergonomics drawback noted in #1293, with the implementation reverted in #1299. An alternative way to go for what it was trying to implement: an `ObjectIdentifierRef` backed by a `&[u8]` is to use a separate struct. With that approach, there could be overlapping `PartialEq`/`Eq` impls that would allow the two to be compared. As a start towards going that route, this gets rid of the generic backing buffer and opts instead to make the struct const generic around its size with a default.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously the v0.10-pre release series has attempted to make
ObjectIdentifiergeneric around a backing buffer containing the BER encoding and bounded onAsRef<[u8]>.This approach has a drawback though: we can't use derived
PartialEq/Eq, which means it isn't possible to use inmatchexpressions anymore, an ergonomics drawback noted in #1293, with the implementation reverted in #1299.An alternative way to go for what it was trying to implement: an
ObjectIdentifierRefbacked by a&[u8]is to use a separate struct. With that approach, there could be overlappingPartialEq/Eqimpls that would allow the two to be compared.As a start towards going that route, this gets rid of the generic backing buffer and opts instead to make the struct const generic around its size with a default.