[][src]Trait endbasic_core::eval::BuiltinFunction

pub trait BuiltinFunction {
    pub fn metadata(&self) -> &CallableMetadata;
pub fn exec(&self, args: Vec<Value>) -> FunctionResult; }

A trait to define a function that is executed by a Machine.

The functions themselves are, for now, pure. They can only access their input arguments and cannot modify the state of the machine.

Idiomatically, these objects need to provide a new() method that returns an Rc<Callable>, as that's the type used throughout the execution engine.

Required methods

pub fn metadata(&self) -> &CallableMetadata[src]

Returns the metadata for this function.

The return value takes the form of a reference to force the callable to store the metadata as a struct field so that calls to this function are guaranteed to be cheap.

pub fn exec(&self, args: Vec<Value>) -> FunctionResult[src]

Executes the function.

args contains the evaluated arguments as provided in the invocation of the function.

Loading content...

Implementors

impl BuiltinFunction for DtoiFunction[src]

impl BuiltinFunction for ItodFunction[src]

impl BuiltinFunction for RndFunction[src]

impl BuiltinFunction for LeftFunction[src]

impl BuiltinFunction for LenFunction[src]

impl BuiltinFunction for LtrimFunction[src]

impl BuiltinFunction for MidFunction[src]

impl BuiltinFunction for RightFunction[src]

impl BuiltinFunction for RtrimFunction[src]

Loading content...