| 1 | [Natord][doc] 1.0.9 |
| 2 | =================== |
| 3 | |
| 4 | [![Natord on Travis CI][travis-image]][travis] |
| 5 | |
| 6 | [travis-image]: https://travis-ci.org/lifthrasiir/rust-natord.png |
| 7 | [travis]: https://travis-ci.org/lifthrasiir/rust-natord |
| 8 | |
| 9 | Natural ordering for Rust. (also known as `rust-natord`) |
| 10 | This allows for the comparison like this: |
| 11 | |
| 12 | ~~~~ {.rust} |
| 13 | let mut files = vec!("rfc2086.txt", "rfc822.txt", "rfc1.txt"); |
| 14 | files.sort_by(|&a, &b| natord::compare(a, b)); |
| 15 | assert_eq!(files, ["rfc1.txt", "rfc822.txt", "rfc2086.txt"]); |
| 16 | ~~~~ |
| 17 | |
| 18 | It provides a `compare` and `compare_ignore_case` function for comparing strings, |
| 19 | and also a `compare_iter` function for the customizable algorithm. |
| 20 | |
| 21 | There are multiple natural ordering algorithms available. |
| 22 | This version of natural ordering is inspired by |
| 23 | [Martin Pool's `strnatcmp.c`](http://sourcefrog.net/projects/natsort/). |
| 24 | See the test cases in the source code to see what it can do and it cannot. |
| 25 | |
| 26 | Natord is written by Kang Seonghoon and licensed under the MIT/X11 license. |
| 27 | |
| 28 | [doc]: https://lifthrasiir.github.io/rust-natord/ |