diff --git a/src/lib.rs b/src/lib.rs index 7f1e936..ca66aad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,7 @@ use std::borrow::Borrow; use std::cmp::min; -use std::collections::hash_map::{self, Entry, Keys, RandomState}; +use std::collections::hash_map::{self, Entry, RandomState}; use std::collections::HashMap; use std::fmt; use std::hash::{BuildHasher, Hash}; @@ -230,7 +230,7 @@ impl MultiSet { /// println!("{}", e); /// } /// ``` - pub fn elements(&self) -> Keys { + pub fn elements(&self) -> Elements { self.elem_counts.keys() } @@ -1192,6 +1192,15 @@ impl ExactSizeIterator for ElementCounts<'_, T> { impl FusedIterator for ElementCounts<'_, T> {} +/// An iterator over the elements of a `MultiSet`. +/// +/// This `struct` is created by the [`elements`] method on [`MultiSet`]. +/// See its documentation for more. +/// +/// [`MultiSet`]: struct.MultiSet.html +/// [`elements`]: struct.MultiSet.html#method.elements +pub type Elements<'a, T> = std::collections::hash_map::Keys<'a, T, usize>; + /// An iterator over the items of a `MultiSet`. /// /// This `struct` is created by the [`iter`] method on [`MultiSet`].