toasty 0.4.0

An async ORM for Rust supporting SQL and NoSQL databases
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::Simplify;
use crate::engine::eval::Func;
use toasty_core::stmt;

impl Simplify<'_> {
    pub(super) fn simplify_expr_map(&self, expr: &mut stmt::Expr) -> Option<stmt::Expr> {
        if expr.as_map_unwrap().base.is_value() {
            let eval = Func::try_from_stmt(expr, vec![])?;

            let ret = eval.eval_const();
            Some(stmt::Expr::Value(ret))
        } else {
            None
        }
    }
}