-
Notifications
You must be signed in to change notification settings - Fork 15
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
unix.rs: modified _get
to return Iterator
instead of Option
#35
Conversation
0e52a20
to
ad5f0cc
Compare
I updated the code via a force push to make it conform to |
@complexspaces, can you review this PR please? |
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.
Thanks for the improvements! I really like the deep testing as well.
My only minor concern with this is that typo-ed locales will result in duplicates (ex en_US
and EN_US
, which doesn't seem like that uncommon of a scenario if a user sets these by hand. Do you think its worth using a separate HashSet
with lowercased strings to do the duplication checking to prevent this?
|
Those points all seem reasonable to me. I just wanted to raise the discussion point. I agree that we shouldn't bloat the library for such a minor thing.
If you'd like to, sure, but I don't think its a deal breaker for this PR merging. |
1. Added `LANGUAGE` and `LC_MESSAGES` variables. 2. Removed `LC_CTYPE` variable. 3. Modified `_get` to return `Iterator` over locales instead of `Option`. 4. Updated tests accordingly.
I have added the corresponding test case. |
I could also add information to the documentation stating that the function neither validates system locales for compliance with the POSIX format nor validates output locales for compliance with the BCP 47 format. P.S. But the function guarantees correct BCP 47 locales for valid POSIX locales. This could also be included in the documentation. |
If we update the documentation, let's leave that for a followup PR. I think the changes here are solid and shouldn't be bikeshed too long.
Do you mean the public |
I would like to propose adding documentation for the Regarding the term "guarantees": I draw this conclusion based on how the |
I would to accept a PR adding a line or two of documentation to the public functions that notes on Linux/BSD systems user-input may influence the format of the returned data. |
I think I'm going to update the documentation regarding Linux/BSD after PR #37. |
I prefer Linux/BSD to be explicit. macOS and Android are two examples of UNIX platforms that don't use the codepaths modified here. |
Released in 0.3.2. Thanks again! |
Related: #14.
LANGUAGE
and theLC_MESSAGES
variables.LC_CTYPE
variable._get
function to return anIterator
over locales instead of anOption
.