oxilean_std/hashset/oxihashset_partition_group.rs
1//! # OxiHashSet - partition_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::collections::HashSet as StdHashSet;
8use std::hash::Hash;
9
10use super::oxihashset_type::OxiHashSet;
11
12impl<T: Eq + Hash + Clone> OxiHashSet<T> {
13 /// Partition into two sets by a predicate.
14 pub fn partition<F: Fn(&T) -> bool>(&self, predicate: F) -> (Self, Self) {
15 let (yes, no): (StdHashSet<_>, StdHashSet<_>) =
16 self.inner.iter().cloned().partition(|e| predicate(e));
17 (Self { inner: yes }, Self { inner: no })
18 }
19}