summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-10-16 11:26:40 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-10-16 11:27:07 +0200
commitb9f1c356f417f628b17dbb75ec3c98786ec31e81 (patch)
tree99cf95f7c04518c9e82babf29a6917d80039ff2d
parent405154a3947a7ceb9f381c382340f7f44497160f (diff)
Add comment for type
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/hashmap.rs8
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
{