Collation NIF interface providing high-performance Unicode collation via ICU4C.
This module wraps the nif_collation_cmp/10 function from Localize.Nif and
provides encoding of collation options to ICU enum values.
Summary
Functions
Returns whether the collation NIF backend is available.
Compare two strings using the ICU NIF collator with full option support.
Returns whether all reorder codes in the list can be mapped to ICU values.
Functions
@spec available?() :: boolean()
Returns whether the collation NIF backend is available.
Returns
trueif the NIF shared library was loaded and the collation function is available.falseotherwise.
@spec nif_compare(String.t(), String.t(), Localize.Collation.Options.t()) :: :lt | :eq | :gt
Compare two strings using the ICU NIF collator with full option support.
Arguments
string_a- the first string to compare.string_b- the second string to compare.options- a%Localize.Collation.Options{}struct.
Returns
:ltifstring_asorts beforestring_b.:eqifstring_aandstring_bare collation-equal.:gtifstring_asorts afterstring_b.
Returns whether all reorder codes in the list can be mapped to ICU values.
Arguments
reorder_codes- a list of script code atoms.
Returns
trueif all codes are recognized.falseif any code is unrecognized.
Examples
iex> Localize.Collation.Nif.reorder_codes_supported?([:Grek, :Latn])
true
iex> Localize.Collation.Nif.reorder_codes_supported?([:Unknown])
false
iex> Localize.Collation.Nif.reorder_codes_supported?([])
true