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

Support creating Rust collator resource references usable from Elixir #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

1 participant