pub struct FunctionMap<T: EvaluationDomain> { /* private fields */ }Expand description
A map of named functions that can be called during evaluation.
Implementations§
Source§impl<T: EvaluationDomain> FunctionMap<T>
impl<T: EvaluationDomain> FunctionMap<T>
Sourcepub fn register(
&mut self,
name: &str,
arity: usize,
func: Box<dyn Fn(&[T]) -> T + Send + Sync>,
)
pub fn register( &mut self, name: &str, arity: usize, func: Box<dyn Fn(&[T]) -> T + Send + Sync>, )
Register a function with the given name and arity.
Sourcepub fn register_alias(&mut self, alias: &str, canonical: &str)
pub fn register_alias(&mut self, alias: &str, canonical: &str)
Register an alias for a function name.
Sourcepub fn resolve(&self, name: &str) -> Option<&FunctionEntry<T>>
pub fn resolve(&self, name: &str) -> Option<&FunctionEntry<T>>
Look up a function by name (resolving aliases and case).
Sourcepub fn call_by_index(&self, idx: usize, args: &[T]) -> Option<T>
pub fn call_by_index(&self, idx: usize, args: &[T]) -> Option<T>
Call a function by its index in the map.
Trait Implementations§
Source§impl<T: EvaluationDomain> Default for FunctionMap<T>
impl<T: EvaluationDomain> Default for FunctionMap<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for FunctionMap<T>
impl<T> !UnwindSafe for FunctionMap<T>
impl<T> Freeze for FunctionMap<T>
impl<T> Send for FunctionMap<T>
impl<T> Sync for FunctionMap<T>
impl<T> Unpin for FunctionMap<T>
impl<T> UnsafeUnpin for FunctionMap<T>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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