1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::*;

pub trait KnowsGetType<'a> {
    type GetType;
}

pub trait HasGet<'a>: KnowsGetType<'a>
where Self::GetType: KnowsPathSegment
{
    fn get<PathSegment>(self, segment: PathSegment) -> Option<Self::GetType>
    where PathSegment: Into<<Self::GetType as KnowsPathSegment>::PathSegment>;
    // TODO: Add default implementation with PathSegment search on HasBranches iterator.
}

impl<'a, T: KnowsGetType<'a>> KnowsGetType<'a> for &'a T {
    type GetType = <T as KnowsGetType<'a>>::GetType;
}

// impl<'a, T: HasGet<'a>> HasGet<'a> for &'a T
// where Self::GetType: KnowsPathSegment<PathSegment = <T::GetType as KnowsPathSegment>::PathSegment>
// {
//     fn get<PathSegment>(&'a self, segment: PathSegment) -> Option<Self::GetType>
//     where PathSegment: Into<<Self::GetType as KnowsPathSegment>::PathSegment> 
//     {
//         // todo!()
//         // (*self).get(segment)
//     }
// }