Skip to content
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

Changed best_matching_locale signature #10

Merged
merged 6 commits into from
Sep 28, 2024
Merged

Conversation

skibon02
Copy link
Contributor

@skibon02 skibon02 commented Sep 28, 2024

PR Type

  • Chore (refactoring, formatting, cleanup, etc.)
  • Performance
  • Usability

Describe changes

  1. Changed the best_matching_locale function signature from
    pub fn best_matching_locale<T1, T2>(available_locales: impl Iterator<Item = T1>, user_locales: impl Iterator<Item = T2>) -> Option<String>
    where
    	T1: AsRef<str>,
    	T2: AsRef<str>
    for bcp47, and
    pub fn best_matching_locale<'a, 'b, T1, T2>(available_locales: impl Iterator<Item = &'a T1>, user_locales: impl Iterator<Item = &'b T2>) -> Option<&'a str>
    where
    	T1: AsRef<str> + 'a,
    	T2: AsRef<str> + 'b
    for posix, to
    pub fn best_matching_locale<T1, T2>(available_locales: impl IntoIterator<Item = T1>, user_locales: impl IntoIterator<Item = T2>) -> Option<T1>
    where
    	T1: AsRef<str>,
    	T2: AsRef<str>
    for both.
  2. Added tests for template parameter types.
  3. Changed the PosixLocale signature from struct PosixLocale<'a> to struct PosixLocale<T: AsRef<str>>.
  4. Refactored tests.
  5. Updated the code examples in the doc comments and README.md.

@pasabanov pasabanov changed the title Return Option<&str> instead of Option<String>, add examples Return Option<&str> instead of Option<String> Sep 28, 2024
@pasabanov pasabanov added enhancement New feature or request performance Improve performance, speed, or resource usage refactor Improving code structure without adding new functionality labels Sep 28, 2024
Use `IntoIterator`
remove vec! from examples
@pasabanov pasabanov added the user-experience Usability or satisfaction of the product label Sep 28, 2024
Ugly but working
@pasabanov pasabanov reopened this Sep 28, 2024
@pasabanov pasabanov changed the title Return Option<&str> instead of Option<String> Changed best_matching_locale signature Sep 28, 2024
@pasabanov pasabanov merged commit 45af206 into pasabanov:main Sep 28, 2024
@pasabanov pasabanov added the tests Adding or fixing tests label Sep 29, 2024
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
pasabanov added a commit that referenced this pull request Oct 1, 2024
1. Changed best_matching_locale signature
2. Added tests for template parameter types
3. Changed PosixLocale signature
4. Refactored tests
5. Updated code examples in doc comments and README.md

---------

Co-authored-by: Petr Sabanov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Improve performance, speed, or resource usage refactor Improving code structure without adding new functionality tests Adding or fixing tests user-experience Usability or satisfaction of the product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants