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>

source

pub fn new( name: Arc<String>, this: Option<Value>, ptx: &'context Context<'context>, args: Vec<Expression> ) -> Self

source

pub fn resolve<R>(&self, resolver: R) -> Result<Value, ExecutionError>
where R: Resolver,

Resolves the given expression using the program’s Context.

source

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>

source§

fn clone(&self) -> FunctionContext<'context>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.