pub fn nat_lex_cmp(a: &str, b: &str) -> OrderingExpand description
A hybrid comparator for string slices:
- If the two strings have the same length, performs a standard lexicographical (byte-wise) comparison.
- Otherwise, falls back to a natural order comparison (
natord::compare).
This is useful for sorting lists containing both fixed-length identifiers (like ULIDs) and variable-length names with embedded numbers (like filenames).
§Arguments
a: The first string slice.b: The second string slice.
§Returns
An Ordering indicating whether a is less than, equal to, or greater than b.