std_collection_traits-0.1.2 doesn't have any documentation.
Rust Collection Traits
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:
- slice:
&[T],&mut [T] - array:
[T; N] - sequence:
Vec<T>,VecDeque<T>,LinkedList<T> - set:
BTreeSet<T>,HashSet<T> - map:
BTreeMap<T>,HashMap<T> - misc:
BinaryHeap<T>
General Categories:
Collection: All collections, excluding associated ones.AllocatorAwareCollection: Allocator-aware collections, currently there is onlyVec<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>::get
AssociatedCollectionAssociatedCapacityAwareCollection: Capacity-aware associated collections.Set<S>: Set-like collections,HashSet<K, S>andBTreeSet<K>OrderedSe<S>: Ordered set-like collections,BTreeSet<K>Map<S>: Map-like collections,HashMap<K, V, S>andBTreeMap<K, V>OrderedMap<S>: Ordered map-like collections,BTreeMap<K, V>
- Other miscellaneous operations
RetainableorAssocaitedRetainable: 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.
TODOs
- Rewrite it based on
Mut/Ownmarker instead of individual types- This requires some non-robust
unreached_uncheckedon default implementation.
- This requires some non-robust
- Find a way to constrain generic associated iterator types
ExactSizedIteratorTrustedRandomAccessDoubleEndedIterator- Still can't propagate requirements to uppermost traits
- Add more collection-like types, like
&str,String - Rewrite all to associated types