Minimum example:
use std::collections::HashSet;
struct Something {
a: HashSet<Point>,
b: HashSet<Point>
}
impl Something {
fn TEST(&self) {
let new = self.a | self.b;
}
}
#[derive(Eq, PartialEq, Hash, Copy, Clone)]
struct Point {
x: usize,
y: usize
}
Check it on the Rust Playground. If you try and compile this code, Rust will complain with error[E0369]: no implementation for std::collections::HashSet<Point> | std::collections::HashSet<Point>.
But according to the docs for HashSet, at least according to my understanding, the BitOr trait should be implemented for a HashSet, where T: Eq + Hash + Clone, which Point clearly is here. So what's actually going on, and how do I fix it?