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
FunctionContext
is a context object passed to functions when they are called.
It contains references to 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 duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const 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