input/seat: Implement Eq&Hash for Seat
use std::{
fmt,
+ hash::Hash,
sync::{Arc, Mutex},
};
@@ -164,6 +165,19 @@ where
}
}
+impl<D: SeatHandler> PartialEq for Seat<D> {
+ fn eq(&self, other: &Self) -> bool {
+ Arc::ptr_eq(&self.arc, &other.arc)
+ }
+}
+impl<D: SeatHandler> Eq for Seat<D> {}
+
+impl<D: SeatHandler> Hash for Seat<D> {
+ fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
+ Arc::as_ptr(&self.arc).hash(state)
+ }
+}
+
pub(crate) struct Inner<D: SeatHandler> {
pub(crate) pointer: Option<PointerHandle<D>>,
pub(crate) keyboard: Option<KeyboardHandle<D>>,
@@ -492,9 +506,3 @@ impl<D: SeatHandler + 'static> Seat<D> {
}
}
}
-
-impl<D: SeatHandler> ::std::cmp::PartialEq for Seat<D> {
- fn eq(&self, other: &Self) -> bool {
- Arc::ptr_eq(&self.arc, &other.arc)
- }
-}
