Struct FunctionKindOverload

Source
pub struct FunctionKindOverload<T> { /* private fields */ }
Expand description

Function overload for a specific argument kind signature.

FunctionKindOverload groups function implementations and declarations that have the same member flag and argument kinds. This allows for efficient lookup and type checking during function resolution.

§Type Parameters

  • T: The type of function stored (implementation or declaration)

§Examples

use cel_cxx::{Kind, function::{FunctionKindOverload, Function}};

// Create overload for member function taking (string, int)
let overload = FunctionKindOverload::<Function<'_>>::new(
    true,
    vec![Kind::String, Kind::Int]
);

Implementations§

Source§

impl<T: FunctionTypeOverload> FunctionKindOverload<T>

Source

pub fn new(member: bool, argument_kinds: Vec<Kind>) -> Self

Creates a new function kind overload.

§Parameters
  • member: Whether this overload is for member functions
  • argument_kinds: The argument kinds this overload handles
§Returns

New FunctionKindOverload instance

Source

pub fn member(&self) -> bool

Returns whether this overload is for member functions.

§Returns

true if this overload handles member functions, false for global functions

Source

pub fn argument_kinds(&self) -> &Vec<Kind>

Returns the argument kinds for this overload.

§Returns

Reference to the vector of argument kinds this overload handles

Source

pub fn find(&self, args: &[ValueType]) -> Option<&T>

Finds a function by exact argument types.

§Parameters
  • args: Argument types to match
§Returns

Reference to the matching function, or None if not found

Source

pub fn entries(&self) -> impl Iterator<Item = &T>

Returns an iterator over all functions in this overload.

§Returns

Iterator over references to all functions in this overload

Source

pub fn entries_mut(&mut self) -> impl Iterator<Item = &mut T>

Returns a mutable iterator over all functions in this overload.

§Returns

Iterator over mutable references to all functions in this overload

Source

pub fn clear(&mut self)

Clears all functions from this overload.

Source

pub fn remove(&mut self, args: &[ValueType]) -> Result<(), Error>

Removes a function by exact argument types.

§Parameters
  • args: Argument types to match for removal
§Returns

Ok(()) if removal was successful, Err(Error) if not found

Source§

impl<'f> FunctionKindOverload<FunctionDeclOrImpl<'f>>

Source

pub fn add_impl(&mut self, f: Function<'f>) -> Result<&mut Self, Error>

Adds a function implementation to this overload group.

This method adds a concrete function implementation to the overload group. The function signature must match the argument kinds of this overload group.

§Arguments
  • f - The function implementation to add
§Returns

Ok(&mut Self) for method chaining, or Err(Error) if the function already exists

§Errors

Returns an error if a function with the same exact signature already exists.

Source

pub fn add_decl(&mut self, type: FunctionType) -> Result<&mut Self, Error>

Adds a function declaration to this overload group.

This method adds a function type signature (declaration) to the overload group. The function signature must match the argument kinds of this overload group.

§Arguments
  • r#type - The function type signature to add
§Returns

Ok(&mut Self) for method chaining, or Err(Error) if the function already exists

§Errors

Returns an error if a function with the same exact signature already exists.

Source§

impl<'f> FunctionKindOverload<Function<'f>>

Source

pub fn add(&mut self, f: Function<'f>) -> Result<&mut Self, Error>

Adds a function (implementation or declaration) to this overload.

This is a convenience method that automatically determines whether to add an implementation or declaration based on the function type.

§Type Parameters
  • F: Function type
  • M: Function marker (sync/async)
  • E: Error type
  • R: Return type
  • A: Argument tuple type
§Parameters
  • f: Function to add
§Returns

Mutable reference to self for chaining, or error if addition failed

Trait Implementations§

Source§

impl<T: Clone> Clone for FunctionKindOverload<T>

Source§

fn clone(&self) -> FunctionKindOverload<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for FunctionKindOverload<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for FunctionKindOverload<T>

§

impl<T> RefUnwindSafe for FunctionKindOverload<T>
where T: RefUnwindSafe,

§

impl<T> Send for FunctionKindOverload<T>
where T: Send,

§

impl<T> Sync for FunctionKindOverload<T>
where T: Sync,

§

impl<T> Unpin for FunctionKindOverload<T>
where T: Unpin,

§

impl<T> UnwindSafe for FunctionKindOverload<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more