1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub trait Identifiable {

    fn path(&self) -> &Vec<usize>;

    fn source_id(&self) -> usize {
        *self.path().first().unwrap()
    }

    fn id(&self) -> usize {
        *self.path().last().unwrap()
    }

    fn parent_path(&self) -> Vec<usize> {
        let mut result = self.path().clone();
        result.pop();
        result
    }
}