rscel 1.0.8

Cel interpreter in rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::interp::Interpreter;
use crate::types::CelByteCode;
use crate::{CelError, CelValue};

pub fn coalesce_impl(ctx: &Interpreter, _this: CelValue, bytecode: &[&CelByteCode]) -> CelValue {
    for arg in bytecode.iter() {
        match ctx.run_raw(arg, true) {
            Ok(CelValue::Null) => {}
            Ok(val) => return val,
            Err(CelError::Binding { .. }) | Err(CelError::Attribute { .. }) => {}
            Err(err) => return CelValue::from_err(err),
        }
    }

    CelValue::from_null()
}