pub struct Function { /* private fields */ }
Expand description
A user-defined function.
Functions can be used in expressions by storing them in a Context
.
Examples
use evalexpr::*;
let mut context = HashMapContext::new();
context.set_function("id".into(), Function::new(|argument| {
Ok(argument.clone())
})).unwrap(); // Do proper error handling here
assert_eq!(eval_with_context("id(4)", &context), Ok(Value::from(4)));
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl !UnwindSafe for Function
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