google / rust_icu

rust_icu: rust bindings for ICU (International Components for Unicode) library
Apache License 2.0
113 stars 34 forks source link

feat: Implement uloc_openAvailableByType() #295

Closed clydegerber closed 10 months ago

clydegerber commented 11 months ago
clydegerber commented 11 months ago

Looks file test failures against the 6.3 ICU version were due to the uloc_openAvailableByType() API not being available until 6.5. I've attempted to add a feature for the 6.5 version and make the new API's dependent on that feature. I would appreciate a thorough review of what I've done, as I simply followed the examples for the other version features. In the course of this I noticed an issue in my previous commits that I'm correcting as well.

filmil commented 10 months ago

Will do, but please allow a day or so.

F

On Fri, Nov 3, 2023 at 10:54 AM clydegerber @.***> wrote:

@.**** commented on this pull request.

In rust_icu_uloc/src/lib.rs https://github.com/google/rust_icu/pull/295#discussion_r1382036312:

@@ -385,6 +385,36 @@ impl ULoc { }) }

  • /// Implements uloc_openAvailableByType.
  • pub fn open_available_by_type(locale_type: ULocAvailableType) -> Result<Enumeration, common::Error> {
  • let mut status = common::Error::OK_CODE;
  • unsafe {
  • let iter = Enumeration::from_raw_parts(None, versioned_function!(uloc_openAvailableByType)(locale_type, &mut status));
  • common::Error::ok_or_warning(status)?;
  • Ok(iter)
  • }
  • }
  • /// Returns a vector of locales of the requested type.
  • pub fn get_available_by_type(locale_type: ULocAvailableType) -> &'static Vec {

Removed the caching and recomputing on every call - have a look.

— Reply to this email directly, view it on GitHub https://github.com/google/rust_icu/pull/295#discussion_r1382036312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB4GMEG5KSQFH6BTD2JFBTYCUVWFAVCNFSM6AAAAAA6YLV3R2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMJTGI2DMOBYGY . You are receiving this because you commented.Message ID: @.***>

filmil commented 10 months ago

Sorry - I had these comments pending for a while but didn't send them out.