rue_typing/type_path.rs
1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
2pub enum TypePath {
3 First,
4 Rest,
5}
6
7pub fn index_to_path(index: usize, nil_terminated: bool) -> Vec<TypePath> {
8 let mut path = Vec::with_capacity(index);
9 for _ in 0..index {
10 path.push(TypePath::Rest);
11 }
12 if nil_terminated {
13 path.push(TypePath::First);
14 }
15 path
16}