Skip to main content

builtin_operand_types

Function builtin_operand_types 

Source
pub fn builtin_operand_types(name: &str) -> Vec<OperandTypes>
Expand description

Returns every built-in overload’s declared operand types for name, in registration order.

Reads the exact same static signature tables BuiltinScope::lookup dispatches against, so the static type checker and the runtime dispatcher share one source of truth and can’t drift apart on which operand-type combinations a built-in operator accepts.

  • Postcondition: returns an empty Vec if name names no built-in operator. A custom scope registered via OpLookup::push_scope or a tuple-shaped op registered via OpLookup::register_tuple_op is runtime-only (attached to one OpLookup instance, not this module’s static tables) and is not visible here — the type checker treats such an operator as unchecked, not an error.

  • Complexity: O(s) where s is the number of overloads registered for name.

§Examples

use cel_parser::op_table::builtin_operand_types;

assert!(builtin_operand_types("+").iter().any(|sig| sig.arity == 2));
assert!(builtin_operand_types("not_an_operator").is_empty());