Practical extension methods for Rust standard library collections.
Enables direct functional-style collection manipulation without the usual iterator boilerplate.
Features
- Equivalents of standard iterator methods are added to standard library collections
- Additional utility methods commonly found in collection libraries are also included
- Transformation methods return a new collection instance instead of returning an iterator
- All methods treat collection instances as immutable although some may consume them
- Performance is near optimal and overhead is limited to new collection creation
Examples
use *;
let a = vec!;
a.fold; // 6
a.filter; // vec![2, 3]
a.map; // vec![2, 3, 4]
a.add.unique; // vec![1, 2, 3]
a.delete_at.tail; // vec![3]
a.interleave; // vec![(1, 4, 2, 5, 3, 6)]
a.group_by; // HashMap::from([(0, vec![2]), (1, vec![1, 3])])
Methods
Inspired by
- Rust Collections
- Scala Collections
- Haskell Collections
- Python Collections
- Qt Collections
- Itertools
- More Itertools
Build
Requirements
- Rust 1.79+
Setup
cargo install cargo-make
Test
makers build
Benchmark
makers bench
Contributing
Please feel free to open an issue or a pull request with questions, ideas, features, improvements or fixes.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.