In-place set operations (union, intersection...)

So rust sets have the following: (my examples will show BTreeSet instead of HashSet simply to make the bounds less noisy)

impl<T> BTreeSet<T> where T: Ord
    fn union(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T>
}
impl<'a, 'b, T> BitOr<&'b BTreeSet<T>> for &'a BTreeSet<T>
 where T: Ord + Clone { ... }

Is there a reason that none of the following exist?

impl<T> BitOr<BTreeSet<T>> for BTreeSet<T> where T: Ord { ... }

impl<T> BitOrAssign<BTreeSet<T>> for BTreeSet<T> where T: Ord { ... }

impl<'a, T> BitOrAssign<&'a BTreeSet<T>> for BTreeSet<T>
 where T: Ord + Clone { ... }
1 Like