cala-cel-interpreter 0.13.11

An interpreter for the Common Expression Language (CEL)
Documentation
use lazy_static::lazy_static;

use std::collections::HashMap;

use crate::builtins;

use super::*;

lazy_static! {
    pub static ref CEL_PACKAGE: CelPackage = {
        let mut idents = HashMap::new();
        idents.insert(
            SELF_PACKAGE_NAME,
            ContextItem::Function(Box::new(|_ctx, args| builtins::timestamp::cast(args))),
        );

        let mut member_fns: HashMap<_, CelMemberFunction> = HashMap::new();
        member_fns.insert("format", Box::new(builtins::timestamp::format));

        CelPackage::new(
            CelContext {
                idents,
                clock: Clock::handle().clone(),
            },
            member_fns,
        )
    };
}