From 66ea275d71904729e4d72532c8308c36e553e518 Mon Sep 17 00:00:00 2001 From: Drakulix Date: Sat, 15 Apr 2017 22:42:42 +0200 Subject: [PATCH] Fixup seat implementation --- src/backend/input.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/backend/input.rs b/src/backend/input.rs index 9c2c613..6703413 100644 --- a/src/backend/input.rs +++ b/src/backend/input.rs @@ -12,8 +12,7 @@ use std::error::Error; /// separated users, all with their own focus, input and cursor available. /// /// Seats can be checked for equality and hashed for differentiation. -// FIXME: Impl PartialEq, Eq and Hash only dependant on `id`. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, Eq)] pub struct Seat { id: u64, capabilities: SeatCapabilities, @@ -39,6 +38,18 @@ impl Seat { } } +impl ::std::cmp::PartialEq for Seat { + fn eq(&self, other: &Seat) -> bool { + self.id == other.id + } +} + +impl ::std::hash::Hash for Seat { + fn hash(&self, state: &mut H) where H: ::std::hash::Hasher { + self.id.hash(state); + } +} + /// Describes capabilities a `Seat` has. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct SeatCapabilities {