feat(expr): from fixed sized array to Expr
This commit is contained in:
@@ -192,6 +192,18 @@ impl From<Vec<Expression>> for Expression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<const N: usize> From<[Expression; N]> for Expression {
|
||||||
|
fn from(mut value: [Expression; N]) -> Self {
|
||||||
|
let mut current = Expression::Nil;
|
||||||
|
|
||||||
|
for e in value.iter_mut().rev() {
|
||||||
|
current = Expression::Cell(Box::new(e.to_owned()), Box::new(current));
|
||||||
|
}
|
||||||
|
|
||||||
|
current
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<(Expression, Expression)> for Expression {
|
impl From<(Expression, Expression)> for Expression {
|
||||||
fn from(value: (Expression, Expression)) -> Self {
|
fn from(value: (Expression, Expression)) -> Self {
|
||||||
Expression::Cell(Box::new(value.0), Box::new(value.1))
|
Expression::Cell(Box::new(value.0), Box::new(value.1))
|
||||||
|
|||||||
Reference in New Issue
Block a user