Skip to content

Release 0.3

Choose a tag to compare

@Aloso Aloso released this 20 Jun 22:13
· 9 commits to main since this release

This release features three new comparison functions and a brand new public API that is more powerful and flexible. Additionally, the benchmark was rewritten and the documentation was improved.

The new API

There are now two traits, StringSort and PathSort, which allow sorting a slice containing strings or paths, or things that implement AsRef<str> or AsRef<Path>:

use lexical_sort::{StringSort, natural_lexical_cmp};

let mut strings = vec!["ß", "é", "100", "hello", "world", "50", ".", "B!"];
strings.string_sort_unstable(natural_lexical_cmp);

Comparison functions

There are now 8 comparison functions available:

Function lexico­graphical natural skips non-alphanumeric chars
cmp
only_alnum_cmp yes
lexical_cmp yes
lexical_only_alnum_cmp yes yes
natural_cmp yes
natural_only_alnum_cmp yes yes
natural_lexical_cmp yes yes
natural_lexical_­only_alnum_cmp yes yes yes

Looking ahead

I plan to implement better Unicode support, although I still have to explore the design space here. I'm also open to feature requests!