oxilean_std/hashset/oxihashset_map_group.rs
1//! # OxiHashSet - map_group Methods
2//!
3//! This module contains method implementations for `OxiHashSet`.
4//!
5//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
6
7use std::hash::Hash;
8
9use super::oxihashset_type::OxiHashSet;
10
11impl<T: Eq + Hash + Clone> OxiHashSet<T> {
12 /// Apply a function to every element, returning a new set.
13 pub fn map<U, F>(&self, f: F) -> OxiHashSet<U>
14 where
15 U: Eq + Hash + Clone,
16 F: Fn(&T) -> U,
17 {
18 OxiHashSet {
19 inner: self.inner.iter().map(f).collect(),
20 }
21 }
22 /// Return an iterator over the elements.
23 pub fn iter(&self) -> impl Iterator<Item = &T> {
24 self.inner.iter()
25 }
26}