This commit is contained in:
Brendan Hansknecht 2023-03-06 21:02:47 -08:00
parent 75e996c445
commit 11cccde050
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
6 changed files with 22 additions and 22 deletions

View file

@ -27,10 +27,11 @@ impl<T> RocSet<T> {
}
}
impl<T: Hash> RocSet<T> {
#[allow(unused)]
pub fn from_iter<I: Iterator<Item = T>>(src: I) -> Self {
Self(RocDict::from_iter(src.map(|elem| (elem, ()))))
impl<T: Hash> FromIterator<T> for RocSet<T> {
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> Self {
Self(RocDict::from_iter(
into_iter.into_iter().map(|elem| (elem, ())),
))
}
}