start with lowlevel

This commit is contained in:
Folkert 2021-05-08 19:01:00 +02:00
parent b172193533
commit 0b02782b73
2 changed files with 73 additions and 10 deletions

View file

@ -1980,3 +1980,21 @@ impl<'a> LayoutIds<'a> {
LayoutId(answer)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum ListLayout<'a> {
EmptyList,
List(&'a Layout<'a>),
}
impl<'a> std::convert::TryFrom<&Layout<'a>> for ListLayout<'a> {
type Error = ();
fn try_from(value: &Layout<'a>) -> Result<Self, Self::Error> {
match value {
Layout::Builtin(Builtin::EmptyList) => Ok(ListLayout::EmptyList),
Layout::Builtin(Builtin::List(_, element)) => Ok(ListLayout::List(element)),
_ => Err(()),
}
}
}