1 2 3 4 5 6 7 8 9
use std::hash::Hash; pub trait Identifiable: Hash + Eq {} impl<T> Identifiable for T where T: Hash + Eq {} pub trait Entity<K: Identifiable> { fn id(&self) -> K; }