Expand description
CEL-Core: High-level API for the Common Expression Language
This crate provides a unified Env for working with CEL expressions,
following the cel-go architecture pattern.
§Quick Start
use cel_core::Env;
use cel_core::CelType;
// Create an environment with standard library and a variable
let env = Env::with_standard_library()
.with_variable("x", CelType::Int);
// Parse and type-check in one step
let ast = env.compile("x + 1").unwrap();
assert!(ast.is_checked());§Architecture
The Env struct coordinates:
- Parser: Converts source text into an AST
- Checker: Type-checks expressions and resolves references
- Variables: User-defined variable declarations
- Functions: Standard library + custom function declarations
§Modules
types: Core type system, AST, and declarationsparser: Lexer, parser, and macro expansionchecker: Type checking and overload resolutionext: Extension libraries (strings, math, encoders, optionals)
§Proto Conversion
For proto wire format conversion (interop with cel-go, cel-cpp), use the
cel-core-proto crate which provides CheckedExpr and ParsedExpr types.
Re-exports§
pub use unparser::ast_to_string;pub use checker::check;pub use checker::CheckError;pub use checker::CheckErrorKind;pub use checker::CheckResult;pub use checker::ReferenceInfo;pub use checker::STANDARD_LIBRARY;pub use parser::parse;pub use parser::ParseError;pub use parser::ParseOptions;pub use parser::ParseResult;pub use types::BinaryOp;pub use types::CelType;pub use types::CelValue;pub use types::Expr;pub use types::FunctionDecl;pub use types::ListElement;pub use types::MapEntry;pub use types::OverloadDecl;pub use types::Span;pub use types::Spanned;pub use types::SpannedExpr;pub use types::StructField;pub use types::UnaryOp;pub use types::VariableDecl;
Modules§
- checker
- CEL Type Checker
- ext
- CEL extension libraries.
- parser
- CEL (Common Expression Language) parser.
- types
- Common types for CEL: type system, values, AST, and declarations.
- unparser
- CEL expression unparser (AST to source text).
Structs§
- Ast
- Unified AST representation matching cel-go’s Ast type.
- Env
- Unified environment for CEL expression processing.
Enums§
- AstError
- Error type for Ast operations.
- Compile
Error - Error from compiling a CEL expression.