diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-10-16 11:26:40 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-10-16 11:27:07 +0200 |
commit | b9f1c356f417f628b17dbb75ec3c98786ec31e81 (patch) | |
tree | 99cf95f7c04518c9e82babf29a6917d80039ff2d | |
parent | 405154a3947a7ceb9f381c382340f7f44497160f (diff) |
Add comment for type
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | src/hashmap.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hashmap.rs b/src/hashmap.rs index ebb6321..dd95b34 100644 --- a/src/hashmap.rs +++ b/src/hashmap.rs @@ -21,6 +21,14 @@ pub enum Error<K> Unknown, } +/// An iterator adapter to collect into a HashMap or error if the iterator yields a key twice +/// +/// # Note +/// +/// The FromIterator implementation for this type preallocates a hashmap using the +/// Iterator::size_hint() function for the size of the hashmap. +/// +/// For an adaptor that does not preallocate, have a look at `CollectOnceHashMapNoPrealloc`. pub struct CollectOnceHashMap<K, V, S = std::collections::hash_map::RandomState> where K: Eq + Hash + Debug { |