Change Set::insert type

This commit is contained in:
Shunsuke Shibayama 2022-09-13 02:36:18 +09:00
parent 2606638253
commit 2fdc881a2e
2 changed files with 7 additions and 2 deletions

View file

@ -118,3 +118,8 @@ where
}
Ok(v)
}
pub fn unique_in_place<T: Eq + std::hash::Hash + Clone>(v: &mut Vec<T>) {
let mut uniques = Set::new();
v.retain(|e| uniques.insert(e.clone()));
}