4 ms·
You're welcome. The implementation in the OP uses a more functional style, but that's not the only way Rust is commonly written. I also did an implementation[0]
by Measter 6y ago
You're welcome. The implementation in the OP uses a more functional style, but that's not the only way Rust is commonly written. I also did an implementation[0] (because I have nothing better to do) using more of an imperative style, which you may be more familiar with. Admittedly I did go a bit overkill on string normalization and avoiding allocations while doing so.
It also includes a test case which the OP's implementation will get wrong because the order of the combining diacritics is different in both words. If you don't normalize them you'll get two different words.
[0] https://gist.github.com/Measter/e2e287ee21311d34ea8eb8cd9d5783be https://gist.github.com/Measter/e2e287ee21311d34ea8eb8cd9d57...