fn eval_plus(left: &AExpr, right: &AExpr) -> Option<AExpr> {
    if let (AExpr::Literal(lit_left), AExpr::Literal(lit_right)) = (left, right) {
        return match (lit_left, lit_right) {
            (ScalarValue::Float32(x), ScalarValue::Float32(y)) => {
                Some(AExpr::Literal(ScalarValue::Float32(x + y)))
            }
            (ScalarValue::Float64(x), ScalarValue::Float64(y)) => {
                Some(AExpr::Literal(ScalarValue::Float64(x + y)))
            }
            (ScalarValue::Int8(x), ScalarValue::Int8(y)) => {
                Some(AExpr::Literal(ScalarValue::Int8(x + y)))
            }
            (ScalarValue::Int16(x), ScalarValue::Int16(y)) => {
                Some(AExpr::Literal(ScalarValue::Int16(x + y)))
            }
            (ScalarValue::Int32(x), ScalarValue::Int32(y)) => {
                Some(AExpr::Literal(ScalarValue::Int32(x + y)))
            }
            (ScalarValue::Int64(x), ScalarValue::Int64(y)) => {
                Some(AExpr::Literal(ScalarValue::Int64(x + y)))
            }
            (ScalarValue::UInt8(x), ScalarValue::UInt8(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt8(x + y)))
            }
            (ScalarValue::UInt16(x), ScalarValue::UInt16(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt16(x + y)))
            }
            (ScalarValue::UInt32(x), ScalarValue::UInt32(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt32(x + y)))
            }
            (ScalarValue::UInt64(x), ScalarValue::UInt64(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt64(x + y)))
            }
            _ => None,
        };
    }
    None
}
// Evaluates x + y if possible
Evaluates x + y if possible
Evaluates x + y if possible
fn eval_plus(left: &AExpr, right: &AExpr) -> Option<AExpr> {
    if let (AExpr::Literal(lit_left), AExpr::Literal(lit_right)) = (left, right) {
        return match (lit_left, lit_right) {
            (ScalarValue::Float32(x), ScalarValue::Float32(y)) => {
                Some(AExpr::Literal(ScalarValue::Float32(x + y)))
            }
            (ScalarValue::Float64(x), ScalarValue::Float64(y)) => {
                Some(AExpr::Literal(ScalarValue::Float64(x + y)))
            }
            (ScalarValue::Int8(x), ScalarValue::Int8(y)) => {
                Some(AExpr::Literal(ScalarValue::Int8(x + y)))
            }
            (ScalarValue::Int16(x), ScalarValue::Int16(y)) => {
                Some(AExpr::Literal(ScalarValue::Int16(x + y)))
            }
            (ScalarValue::Int32(x), ScalarValue::Int32(y)) => {
                Some(AExpr::Literal(ScalarValue::Int32(x + y)))
            }
            (ScalarValue::Int64(x), ScalarValue::Int64(y)) => {
                Some(AExpr::Literal(ScalarValue::Int64(x + y)))
            }
            (ScalarValue::UInt8(x), ScalarValue::UInt8(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt8(x + y)))
            }
            (ScalarValue::UInt16(x), ScalarValue::UInt16(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt16(x + y)))
            }
            (ScalarValue::UInt32(x), ScalarValue::UInt32(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt32(x + y)))
            }
            (ScalarValue::UInt64(x), ScalarValue::UInt64(y)) => {
                Some(AExpr::Literal(ScalarValue::UInt64(x + y)))
            }
            _ => None,
        };
    }
    None
}
fn eval_plus ( left : & AExpr , right : & AExpr ) -> Option < AExpr > { if let ( AExpr :: Literal ( lit_left ) , AExpr :: Literal ( lit_right ) ) = ( left , right ) { return match ( lit_left , lit_right ) { ( ScalarValue :: Float32 ( x ) , ScalarValue :: Float32 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: Float32 ( x + y ) ) ) } ( ScalarValue :: Float64 ( x ) , ScalarValue :: Float64 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: Float64 ( x + y ) ) ) } ( ScalarValue :: Int8 ( x ) , ScalarValue :: Int8 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: Int8 ( x + y ) ) ) } ( ScalarValue :: Int16 ( x ) , ScalarValue :: Int16 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: Int16 ( x + y ) ) ) } ( ScalarValue :: Int32 ( x ) , ScalarValue :: Int32 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: Int32 ( x + y ) ) ) } ( ScalarValue :: Int64 ( x ) , ScalarValue :: Int64 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: Int64 ( x + y ) ) ) } ( ScalarValue :: UInt8 ( x ) , ScalarValue :: UInt8 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: UInt8 ( x + y ) ) ) } ( ScalarValue :: UInt16 ( x ) , ScalarValue :: UInt16 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: UInt16 ( x + y ) ) ) } ( ScalarValue :: UInt32 ( x ) , ScalarValue :: UInt32 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: UInt32 ( x + y ) ) ) } ( ScalarValue :: UInt64 ( x ) , ScalarValue :: UInt64 ( y ) ) => { Some ( AExpr :: Literal ( ScalarValue :: UInt64 ( x + y ) ) ) } _ => None , } ; } None }
Evaluates x + y if possible
Evaluates x + y if possible
left
&AExpr
right
&AExpr
left
&AExpr
right
&AExpr