Trait NativeFn

Source
pub trait NativeFn<T> {
    // Required method
    fn evaluate<'a>(
        &self,
        args: Vec<SpannedValue<'a, T>>,
        context: &mut CallContext<'_, 'a, T>,
    ) -> EvalResult<'a, T>;
}
Expand description

Function on zero or more Values.

Native functions are defined in the Rust code and then can be used from the interpreted code. See fns module docs for different ways to define native functions.

Required Methods§

Source

fn evaluate<'a>( &self, args: Vec<SpannedValue<'a, T>>, context: &mut CallContext<'_, 'a, T>, ) -> EvalResult<'a, T>

Executes the function on the specified arguments.

Trait Implementations§

Source§

impl<T> Debug for dyn NativeFn<T>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§

Source§

impl<Num, F, Ret> NativeFn<Num> for FnWrapper<(Ret,), F>
where F: Fn() -> Ret, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T> NativeFn<Num> for FnWrapper<(Ret, T), F>
where F: Fn(T) -> Ret, T: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U> NativeFn<Num> for FnWrapper<(Ret, T, U), F>
where F: Fn(T, U) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V> NativeFn<Num> for FnWrapper<(Ret, T, U, V), F>
where F: Fn(T, U, V) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W), F>
where F: Fn(T, U, V, W) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W, X> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W, X), F>
where F: Fn(T, U, V, W, X) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, X: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W, X, Y> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W, X, Y), F>
where F: Fn(T, U, V, W, X, Y) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, X: for<'val> TryFromValue<'val, Num>, Y: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W, X, Y, Z> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W, X, Y, Z), F>
where F: Fn(T, U, V, W, X, Y, Z) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, X: for<'val> TryFromValue<'val, Num>, Y: for<'val> TryFromValue<'val, Num>, Z: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W, X, Y, Z, A> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W, X, Y, Z, A), F>
where F: Fn(T, U, V, W, X, Y, Z, A) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, X: for<'val> TryFromValue<'val, Num>, Y: for<'val> TryFromValue<'val, Num>, Z: for<'val> TryFromValue<'val, Num>, A: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W, X, Y, Z, A, B> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W, X, Y, Z, A, B), F>
where F: Fn(T, U, V, W, X, Y, Z, A, B) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, X: for<'val> TryFromValue<'val, Num>, Y: for<'val> TryFromValue<'val, Num>, Z: for<'val> TryFromValue<'val, Num>, A: for<'val> TryFromValue<'val, Num>, B: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<Num, F, Ret, T, U, V, W, X, Y, Z, A, B, C> NativeFn<Num> for FnWrapper<(Ret, T, U, V, W, X, Y, Z, A, B, C), F>
where F: Fn(T, U, V, W, X, Y, Z, A, B, C) -> Ret, T: for<'val> TryFromValue<'val, Num>, U: for<'val> TryFromValue<'val, Num>, V: for<'val> TryFromValue<'val, Num>, W: for<'val> TryFromValue<'val, Num>, X: for<'val> TryFromValue<'val, Num>, Y: for<'val> TryFromValue<'val, Num>, Z: for<'val> TryFromValue<'val, Num>, A: for<'val> TryFromValue<'val, Num>, B: for<'val> TryFromValue<'val, Num>, C: for<'val> TryFromValue<'val, Num>, Ret: for<'val> IntoEvalResult<'val, Num>,

Source§

impl<T> NativeFn<T> for Compare

Source§

impl<T> NativeFn<T> for Array
where T: Clone + Zero + One,

Source§

impl<T> NativeFn<T> for Assert

Source§

impl<T> NativeFn<T> for If

Source§

impl<T> NativeFn<T> for Push

Source§

impl<T, F> NativeFn<T> for F
where F: for<'a> Fn(Vec<SpannedValue<'a, T>>, &mut CallContext<'_, 'a, T>) -> EvalResult<'a, T> + 'static,

Source§

impl<T: Clone> NativeFn<T> for Filter

Source§

impl<T: Clone> NativeFn<T> for Fold

Source§

impl<T: Clone> NativeFn<T> for Loop

Source§

impl<T: Clone> NativeFn<T> for Map

Source§

impl<T: Clone> NativeFn<T> for Merge

Source§

impl<T: Clone> NativeFn<T> for While

Source§

impl<T: Display> NativeFn<T> for AssertEq

Source§

impl<T: Display> NativeFn<T> for Dbg

Source§

impl<T: FromPrimitive> NativeFn<T> for Len