https://github.com/moko256/mini_natural_sort_rust
Simple no-std natural (human-readable) sort crate.
https://github.com/moko256/mini_natural_sort_rust
natural-sort rust rust-lang sort-order
Last synced: 9 months ago
JSON representation
Simple no-std natural (human-readable) sort crate.
- Host: GitHub
- URL: https://github.com/moko256/mini_natural_sort_rust
- Owner: moko256
- License: mit
- Created: 2025-08-13T09:01:48.000Z (10 months ago)
- Default Branch: current
- Last Pushed: 2025-08-13T09:30:52.000Z (10 months ago)
- Last Synced: 2025-08-13T11:27:41.981Z (10 months ago)
- Topics: natural-sort, rust, rust-lang, sort-order
- Language: Rust
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## mini_natural_sort
Simple no-std natural (human-readable) sort crate.
### Examples
```rust
use mini_natural_sort::{compare_str_natural, NaturalSortKey};
// Sorting list by function.
let mut filenames = ["b001.txt", "b1.txt", "b000002.txt", "A.txt", "a.txt", "c.txt", "c_copy (1).txt"];
filenames.sort_by(compare_str_natural);
let sorted = ["a.txt", "b1.txt", "b001.txt", "b000002.txt", "c.txt", "c_copy (1).txt", "A.txt"];
assert_eq!(filenames, sorted);
// Comparing two strings by struct.
assert!(NaturalSortKey::from("0000001") < NaturalSortKey::from("2"));
```
### Install
```toml
[dependencies]
mini_natural_sort = { git = "https://github.com/moko256/mini_natural_sort_rust.git", tag = "v2.0.1" }
```
### License
SPDX-License-Identifier: MIT