Fixup seat implementation

This commit is contained in:
Drakulix 2017-04-15 22:42:42 +02:00
parent 4c591a86bd
commit 66ea275d71
1 changed files with 13 additions and 2 deletions

View File

@ -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<H>(&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 {