use core::marker::PhantomData;
use super::store::RelEntry;
pub struct Here;
pub struct There<W>(PhantomData<W>);
pub trait FindRel<Rel, Witness> {
type Data;
fn get(&self) -> &Self::Data;
}
impl<Rel, Data, Rest> FindRel<Rel, Here> for RelEntry<Rel, Data, Rest> {
type Data = Data;
fn get(&self) -> &Data {
&self.data
}
}
impl<Rel, Other, Data, Rest, W> FindRel<Rel, There<W>> for RelEntry<Other, Data, Rest>
where
Rest: FindRel<Rel, W>,
{
type Data = <Rest as FindRel<Rel, W>>::Data;
fn get(&self) -> &Self::Data {
self.rest.get()
}
}