-
Notifications
You must be signed in to change notification settings - Fork 175
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
Add total_cmp
helper functions to icu_locid types and DataLocale
#4608
Conversation
pub(crate) fn as_tuple( | ||
&self, | ||
) -> ( | ||
(&unicode::Attributes, &unicode::Keywords), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...wow that's a type
not 100% convinced this is needed over FFI but it's a weak opinion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rephrase the comment. Instead of "may or may not be stable", we should say "we do not guarantee stability across versions".
e635305
We do not implement
Ord
onLocale
orLanguageIdentifier
because there are multiple possible orderings, and we did not want to privilege one ordering over another (see #1215).We export a
strict_cmp
function that compares the receiver with a byte array. However, we do not export a function that compares the receiver to another object of the same type. This had led to issues such as #3588. I also stumbled across this today when trying to make aBTreeSet
of locales.In order to serve this use case, I added the following function to the types that needed it:
This gives us flexibility moving forward to tweak the impl or add additional comparison functions producing different orderings.