Struct cel_interpreter::FunctionContext
source · pub struct FunctionContext<'context> {
pub name: Arc<String>,
pub this: Option<Value>,
pub ptx: &'context Context<'context>,
pub args: Vec<Expression>,
pub arg_idx: usize,
}
Expand description
FunctionCtx is a context object passed to functions when they are called.
It contains references ot the target object (if the function is called as
a method), the program context (Context
) which gives functions access
to variables, and the arguments to the function call.
Fields§
§name: Arc<String>
§this: Option<Value>
§ptx: &'context Context<'context>
§args: Vec<Expression>
§arg_idx: usize
Implementations§
source§impl<'context> FunctionContext<'context>
impl<'context> FunctionContext<'context>
pub fn new( name: Arc<String>, this: Option<Value>, ptx: &'context Context<'context>, args: Vec<Expression> ) -> Self
sourcepub fn resolve<R>(&self, resolver: R) -> Result<Value, ExecutionError>where
R: Resolver,
pub fn resolve<R>(&self, resolver: R) -> Result<Value, ExecutionError>where
R: Resolver,
Resolves the given expression using the program’s Context
.
sourcepub fn error<M: ToString>(&self, message: M) -> ExecutionError
pub fn error<M: ToString>(&self, message: M) -> ExecutionError
Returns an execution error for the currently execution function.
Trait Implementations§
source§impl<'context> Clone for FunctionContext<'context>
impl<'context> Clone for FunctionContext<'context>
source§fn clone(&self) -> FunctionContext<'context>
fn clone(&self) -> FunctionContext<'context>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'context> Freeze for FunctionContext<'context>
impl<'context> !RefUnwindSafe for FunctionContext<'context>
impl<'context> !Send for FunctionContext<'context>
impl<'context> !Sync for FunctionContext<'context>
impl<'context> Unpin for FunctionContext<'context>
impl<'context> !UnwindSafe for FunctionContext<'context>
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