Skip to content

Conversation

@foxbenjaminfox
Copy link
Collaborator

As described in #9, we want to also have an interface in which the user of the Elixir obtains a reference to a Collator Rust resource and uses it in multiple calls. This PR implements the NIF API for that interface.

This NIF API has a create_collator/2 function that takes a locale and an options map and returns a reference that can be passed as the first argument to sort_using_collator/2. For example:

collator = Cldr.Collation.Nif.create_collator("en", %{strength: :primary, alternate_handling: nil, case_first: nil, max_variable: nil, case_level: nil, numeric: nil, backward_second_level: nil})

assert Cldr.Collation.Nif.sort_using_collator(collator, ["AAAA", "AAAa"]) == ["AAAA", "AAAa"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants