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>
impl<T: FunctionTypeOverload> FunctionKindOverload<T>
Sourcepub fn member(&self) -> bool
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
Sourcepub fn argument_kinds(&self) -> &Vec<Kind>
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
Sourcepub fn entries(&self) -> impl Iterator<Item = &T>
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
Sourcepub fn entries_mut(&mut self) -> impl Iterator<Item = &mut T>
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§impl<'f> FunctionKindOverload<FunctionDeclOrImpl<'f>>
impl<'f> FunctionKindOverload<FunctionDeclOrImpl<'f>>
Sourcepub fn add_impl(&mut self, f: Function<'f>) -> Result<&mut Self, Error>
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.
Sourcepub fn add_decl(&mut self, type: FunctionType) -> Result<&mut Self, Error>
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>>
impl<'f> FunctionKindOverload<Function<'f>>
Sourcepub fn add(&mut self, f: Function<'f>) -> Result<&mut Self, Error>
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 typeM
: Function marker (sync/async)E
: Error typeR
: Return typeA
: 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>
impl<T: Clone> Clone for FunctionKindOverload<T>
Source§fn clone(&self) -> FunctionKindOverload<T>
fn clone(&self) -> FunctionKindOverload<T>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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