pub trait NonEmptyArguments: Arguments + Sealed { }Expand description
Marker trait for function argument tuples with at least one parameter.
This trait extends Arguments to identify function signatures that have
at least one argument. It is used to restrict member function registration
to ensure that member functions always have a receiver object as their first
parameter.
§Purpose
Member functions in CEL must have at least one argument (the receiver object).
This trait provides compile-time type checking to enforce this constraint
when registering member functions through FunctionRegistry::register_member.
§Implementation Details
This trait is automatically implemented for all non-empty argument tuples
(1 to 10 parameters) through the [impl_arguments!] macro. The empty tuple
() implements Arguments but does not implement NonEmptyArguments,
which allows the type system to distinguish between zero-argument and
non-zero-argument functions.
§Usage in Member Functions
When registering a member function, the type system requires:
Args: Arguments + NonEmptyArgumentsThis constraint ensures that:
- Member functions cannot be registered with zero arguments
- The first argument of a member function represents the receiver object
- Type safety is enforced at compile time
§Examples
Valid member function signatures (implement NonEmptyArguments):
(String)- one argument(String, i64)- two arguments(Vec<i64>, bool)- two arguments
Invalid member function signature (does not implement NonEmptyArguments):
()- zero arguments (cannot be used for member functions)
§Note
This trait is sealed and cannot be implemented outside this crate. It is automatically implemented for argument tuples with 1 to 10 parameters.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.