Skip to content

Commit

Permalink
rename IterElementCounts to match the method that produces it (C-ITER…
Browse files Browse the repository at this point in the history
…-TY)
  • Loading branch information
lonnen committed Mar 18, 2020
1 parent c473fd6 commit a050498
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ impl<T, S> MultiSet<T, S> {
/// println!("{}: {}", elem, count);
/// }
/// ```
pub fn element_counts(&self) -> IterElementCounts<T> {
IterElementCounts {
pub fn element_counts(&self) -> ElementCounts<T> {
ElementCounts {
iter: self.elem_counts.iter(),
}
}
Expand Down Expand Up @@ -1150,19 +1150,19 @@ impl<'a, T: Eq + Hash + Clone, S: BuildHasher + Default> Extend<&'a T> for Multi
/// [`MultiSet`]: struct.MultiSet.html
/// [`element_counts`]: struct.MultiSet.html#method.element_counts
#[derive(Debug)]
pub struct IterElementCounts<'a, T: 'a> {
pub struct ElementCounts<'a, T: 'a> {
iter: MapIter<'a, T, usize>,
}

impl<T> Clone for IterElementCounts<'_, T> {
impl<T> Clone for ElementCounts<'_, T> {
fn clone(&self) -> Self {
IterElementCounts {
ElementCounts {
iter: self.iter.clone(),
}
}
}

impl<'a, T> Iterator for IterElementCounts<'a, T> {
impl<'a, T> Iterator for ElementCounts<'a, T> {
type Item = (&'a T, &'a usize);

fn next(&mut self) -> Option<(&'a T, &'a usize)> {
Expand All @@ -1174,13 +1174,13 @@ impl<'a, T> Iterator for IterElementCounts<'a, T> {
}
}

impl<T> ExactSizeIterator for IterElementCounts<'_, T> {
impl<T> ExactSizeIterator for ElementCounts<'_, T> {
fn len(&self) -> usize {
self.iter.len()
}
}

impl<T> FusedIterator for IterElementCounts<'_, T> {}
impl<T> FusedIterator for ElementCounts<'_, T> {}

/// An iterator over the items of a `MultiSet`.
///
Expand Down

0 comments on commit a050498

Please sign in to comment.