Skip to content

Commit

Permalink
Merge pull request #236 from cuviper/modules
Browse files Browse the repository at this point in the history
Refactor modules (no functional change)
  • Loading branch information
cuviper authored Jul 13, 2022
2 parents b283dd7 + 36c918d commit 9a5b1fa
Show file tree
Hide file tree
Showing 8 changed files with 1,968 additions and 1,881 deletions.
868 changes: 19 additions & 849 deletions src/map.rs

Large diffs are not rendered by default.

463 changes: 463 additions & 0 deletions src/map/iter.rs

Large diffs are not rendered by default.

32 changes: 8 additions & 24 deletions src/map/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,51 +169,37 @@ impl<K, V> Slice<K, V> {

/// Return an iterator over the key-value pairs of the map slice.
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.entries.iter(),
}
Iter::new(&self.entries)
}

/// Return an iterator over the key-value pairs of the map slice.
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut {
iter: self.entries.iter_mut(),
}
IterMut::new(&mut self.entries)
}

/// Return an iterator over the keys of the map slice.
pub fn keys(&self) -> Keys<'_, K, V> {
Keys {
iter: self.entries.iter(),
}
Keys::new(&self.entries)
}

/// Return an owning iterator over the keys of the map slice.
pub fn into_keys(self: Box<Self>) -> IntoKeys<K, V> {
IntoKeys {
iter: self.into_entries().into_iter(),
}
IntoKeys::new(self.into_entries())
}

/// Return an iterator over the values of the map slice.
pub fn values(&self) -> Values<'_, K, V> {
Values {
iter: self.entries.iter(),
}
Values::new(&self.entries)
}

/// Return an iterator over mutable references to the the values of the map slice.
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
ValuesMut {
iter: self.entries.iter_mut(),
}
ValuesMut::new(&mut self.entries)
}

/// Return an owning iterator over the values of the map slice.
pub fn into_values(self: Box<Self>) -> IntoValues<K, V> {
IntoValues {
iter: self.into_entries().into_iter(),
}
IntoValues::new(self.into_entries())
}
}

Expand All @@ -240,9 +226,7 @@ impl<K, V> IntoIterator for Box<Slice<K, V>> {
type Item = (K, V);

fn into_iter(self) -> Self::IntoIter {
IntoIter {
iter: self.into_entries().into_iter(),
}
IntoIter::new(self.into_entries())
}
}

Expand Down
Loading

0 comments on commit 9a5b1fa

Please sign in to comment.