| Crates.io | std_collection_traits |
| lib.rs | std_collection_traits |
| version | 0.1.2 |
| created_at | 2021-08-16 07:16:30.988163+00 |
| updated_at | 2021-08-17 02:21:33.331112+00 |
| description | Abstraction of operations in std collection types |
| homepage | https://github.com/Airtnp/collection_traits |
| repository | https://github.com/Airtnp/collection_traits |
| max_upload_size | |
| id | 437721 |
| size | 99,377 |
Abstract common operations from std collections. For a working sample, check tests/group_by.rs
This crate is experimental. Better a RFC is needed to formally abstract operations (like Cpp Concept/Named requirements).
Collections in std:
&[T], &mut [T][T; N]Vec<T>, VecDeque<T>, LinkedList<T>BTreeSet<T>, HashSet<T>BTreeMap<T>, HashMap<T>BinaryHeap<T>General Categories:
Collection: All collections, excluding associated ones.
AllocatorAwareCollection: Allocator-aware collections, currently there is only Vec<T, A>.CapacityAwareCollection: Capacity-aware collections, those you can reserve, create with a given amount of capacity. E.g. HashSet::with_capacityContiguousCollection: Contiguous collections, where behaves like a contiguous region of memory. E.g. Vec::as_sliceSequentialCollection: Sequential collections, where you can traverse it in one direction, and modify at the end. E.g. VecDeque::push_backDoubleEndedCollection: Double-ended collections, where you do sequential-like operations on both ends. E.g. LinkedList<T>::pop_frontRandomAccessCollection: Random access collections, where you can access by indices. E.g. VecDeque<T>::getAssociatedCollection
AssociatedCapacityAwareCollection: Capacity-aware associated collections.Set<S>: Set-like collections, HashSet<K, S> and BTreeSet<K>OrderedSe<S>: Ordered set-like collections, BTreeSet<K>Map<S>: Map-like collections, HashMap<K, V, S> and BTreeMap<K, V>OrderedMap<S>: Ordered map-like collections, BTreeMap<K, V>Retainable or AssocaitedRetainable: Ability to retain specific elements.Contains: Ability to test if an element is in sequence.DrainFull/DrainRange/{Associated}DrainFilter: Ability to drain a specific amount of elements without drop the original collection.Range/RangeMut: Ability to generate a view of original sequence.Mut/Own marker instead of individual types
unreached_unchecked on default implementation.ExactSizedIteratorTrustedRandomAccessDoubleEndedIterator&str, String