Skip to main content

IntoScriptFn

Trait IntoScriptFn 

Source
pub trait IntoScriptFn<Marker> {
    // Required method
    fn into_script_fn_parts(self) -> (Vec<ScriptTy>, ScriptTy, ScriptFnBody);
}
Expand description

Adapts a plain Rust closure into the body and signature of a ScriptFn.

The Marker parameter disambiguates the per-arity impls, the same trick Rhai and Bevy use so one entry point accepts closures of many shapes without a type annotation. Arity runs to MAX_VARIADIC_ARITY; past that, describe the function with ScriptFn::new.

Required Methods§

Source

fn into_script_fn_parts(self) -> (Vec<ScriptTy>, ScriptTy, ScriptFnBody)

The declared parameter types, the declared return type, and the body.

Driven by ScriptFn::from_fn; not meant to be called directly.

Implementors§

Source§

impl<F, R> IntoScriptFn<Arity0> for F
where F: Fn() -> R + Send + Sync + 'static, R: ScriptRet,

Source§

impl<F, R, A0> IntoScriptFn<(A0,)> for F
where F: Fn(A0) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static,

Source§

impl<F, R, A0, A1> IntoScriptFn<(A0, A1)> for F
where F: Fn(A0, A1) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static,

Source§

impl<F, R, A0, A1, A2> IntoScriptFn<(A0, A1, A2)> for F
where F: Fn(A0, A1, A2) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static, A2: ScriptType + 'static,

Source§

impl<F, R, A0, A1, A2, A3> IntoScriptFn<(A0, A1, A2, A3)> for F
where F: Fn(A0, A1, A2, A3) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static, A2: ScriptType + 'static, A3: ScriptType + 'static,

Source§

impl<F, R, A0, A1, A2, A3, A4> IntoScriptFn<(A0, A1, A2, A3, A4)> for F
where F: Fn(A0, A1, A2, A3, A4) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static, A2: ScriptType + 'static, A3: ScriptType + 'static, A4: ScriptType + 'static,

Source§

impl<F, R, A0, A1, A2, A3, A4, A5> IntoScriptFn<(A0, A1, A2, A3, A4, A5)> for F
where F: Fn(A0, A1, A2, A3, A4, A5) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static, A2: ScriptType + 'static, A3: ScriptType + 'static, A4: ScriptType + 'static, A5: ScriptType + 'static,

Source§

impl<F, R, A0, A1, A2, A3, A4, A5, A6> IntoScriptFn<(A0, A1, A2, A3, A4, A5, A6)> for F
where F: Fn(A0, A1, A2, A3, A4, A5, A6) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static, A2: ScriptType + 'static, A3: ScriptType + 'static, A4: ScriptType + 'static, A5: ScriptType + 'static, A6: ScriptType + 'static,

Source§

impl<F, R, A0, A1, A2, A3, A4, A5, A6, A7> IntoScriptFn<(A0, A1, A2, A3, A4, A5, A6, A7)> for F
where F: Fn(A0, A1, A2, A3, A4, A5, A6, A7) -> R + Send + Sync + 'static, R: ScriptRet, A0: ScriptType + 'static, A1: ScriptType + 'static, A2: ScriptType + 'static, A3: ScriptType + 'static, A4: ScriptType + 'static, A5: ScriptType + 'static, A6: ScriptType + 'static, A7: ScriptType + 'static,