Add unicode_ext_value! macro, enabled by new helper ShortVec #1767
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.
This PR introduces
ShortVec
, an internal class toicu_locid
, which looks like this:With this type, I can swap out the internals of
Value
to useShortVec
, and then, with a little bit of gymnastics due to rust-lang/rust#73255, I can getunicode_ext_value!
to work:If you like this direction, we could:
Value
in Unicode and TransformVec
toShortVec
If we did (2), then, with some gymnastics, we could actually make the following compile, which seems cool:
However, this is a little further off, because it would require replacing
LiteMap
again, or changingLiteMap
itself to useShortVec
. I lean against this generalization for the time being since it is generally expected that there are multiple Unicode extension keywords, whereas with the values, they are often only one subtag long.We actually could already do
locale!("en-t-hi")
without changing anything in the data model.