sorted-groups
sorted-groups implement a data structure to store elements in sorted groups while maintaining the order of elements in each group.
Usage
First, add the sorted_groups crate as a dependency:
use SortedGroups;
// Elements will be grouped by the `group` field
let mut sorted_groups = new;
sorted_groups.insert;
sorted_groups.insert;
sorted_groups.insert;
// `len` returns the total number of elements
assert_eq!;
// `groups_len` returns the number of groups
assert_eq!;
// `iter` returns an iterator over groups and elements
let mut iter = sorted_groups.iter;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
License
This project is distributed under the terms of the Apache License (Version 2.0).
See LICENSE