Skip to main content

Module registered_ops

Module registered_ops 

Source
Expand description

Persistent operation and record metadata shared by independent host libraries.

Register a function marker once, then add disjoint operand signatures from any installer. Ordinary calls and direct member lookup share the same emitters:

use cel_parser::{OpLookup, OperationSignature, ResolvedLeafType};
use cel_runtime::ValueType;
#[derive(Clone)]
struct Identity;
let mut lookup = OpLookup::new();
lookup.register_function("identity", Identity).unwrap();
let ty = ResolvedLeafType::new("u32", ValueType::leaf::<u32>());
lookup.register_operation(OperationSignature {
    name: "identity", operands: vec![ty.clone().into()], result: ty.into(),
    emit: Box::new(|segment, _| segment.op1(|value: u32| value)),
}).unwrap();
assert_eq!(lookup.operation_signatures("identity").count(), 1);

Structs§

OperationSignature
Describes one named operation with complete concrete operand and result identities.
RecordField
Describes one required record field.
RecordSchema
Describes a named record’s required fields and construction implementation.

Type Aliases§

OperationEmitter
Emits an operation after the complete operand signature has matched.
RecordEmitter
Consumes source-order fields using source-position to schema-position indices, the ambient stack byte offset, and the expression span.