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.map_ref.to_map; // HashMap::from([(1, 2), (2, 3), (3, 4)])
a.flat_map.sorted; // vec![-3, -2, -1, 1, 2, 3]
a.filter.into_set; // HashSet::from([2, 3])
a.group_by; // HashMap::from([(0, vec![2]), (1, vec![1, 3])])
a.delete.add.unique; // vec![2, 3]
a.substitute_at.to_list; // LinkedList::from([4, 2, 3])
a.position_multi; // vec![0, 2]
a.rev.into_iter.into_deque; // VecDeque::from([3, 2, 1])
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.