NonEmptyArguments

Trait NonEmptyArguments 

Source
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 + NonEmptyArguments

This 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.

Implementations on Foreign Types§

Source§

impl<A1: FromValue + TypedValue> NonEmptyArguments for (A1,)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue> NonEmptyArguments for (A1, A2)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue, A5: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4, A5)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue, A5: FromValue + TypedValue, A6: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4, A5, A6)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue, A5: FromValue + TypedValue, A6: FromValue + TypedValue, A7: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4, A5, A6, A7)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue, A5: FromValue + TypedValue, A6: FromValue + TypedValue, A7: FromValue + TypedValue, A8: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4, A5, A6, A7, A8)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue, A5: FromValue + TypedValue, A6: FromValue + TypedValue, A7: FromValue + TypedValue, A8: FromValue + TypedValue, A9: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4, A5, A6, A7, A8, A9)

Source§

impl<A1: FromValue + TypedValue, A2: FromValue + TypedValue, A3: FromValue + TypedValue, A4: FromValue + TypedValue, A5: FromValue + TypedValue, A6: FromValue + TypedValue, A7: FromValue + TypedValue, A8: FromValue + TypedValue, A9: FromValue + TypedValue, A10: FromValue + TypedValue> NonEmptyArguments for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)

Implementors§