use crate::model::id::Id;
pub trait Entity {
fn id(&self) -> Id<Self>;
}
pub trait EntityRef<E: Entity> {
fn entity_ref(&self) -> Id<E>;
}
impl<E: Entity> EntityRef<E> for &E {
fn entity_ref(&self) -> Id<E> {
self.id()
}
}
impl<E: Entity> EntityRef<E> for Id<E> {
fn entity_ref(&self) -> Id<E> {
*self
}
}
impl<E: Entity> EntityRef<E> for &Id<E> {
fn entity_ref(&self) -> Id<E> {
**self
}
}