Skip to main content

ScriptFnAppExt

Trait ScriptFnAppExt 

Source
pub trait ScriptFnAppExt {
    // Required methods
    fn add_script_fn(&mut self, f: ScriptFn) -> &mut Self;
    fn add_script_fns(
        &mut self,
        fns: impl IntoIterator<Item = ScriptFn>,
    ) -> &mut Self;
    fn add_script_prelude(
        &mut self,
        lang: &str,
        ns: &str,
        source: &str,
    ) -> &mut Self;
}
Expand description

Register script functions on an App.

Install the plugin that calls these through RunOptions::with_plugin, or through the Rust SDK’s lumenui::App::add_plugin; both run before the script hosts load. A registration made after that is refused: Rhai and Lua would bind a function no already-compiled program resolves, and candela binds its host declarations when the program compiles or the artifact loads, so there is nothing left to bind to.

Required Methods§

Source

fn add_script_fn(&mut self, f: ScriptFn) -> &mut Self

Register one function.

Source

fn add_script_fns( &mut self, fns: impl IntoIterator<Item = ScriptFn>, ) -> &mut Self

Register several functions, in order.

Source

fn add_script_prelude( &mut self, lang: &str, ns: &str, source: &str, ) -> &mut Self

Register source in lang that the host of that language compiles ahead of the app’s own program, wrapping the functions registered under ns.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ScriptFnAppExt for App

Source§

fn add_script_fn(&mut self, f: ScriptFn) -> &mut Self

Source§

fn add_script_fns( &mut self, fns: impl IntoIterator<Item = ScriptFn>, ) -> &mut Self

Source§

fn add_script_prelude( &mut self, lang: &str, ns: &str, source: &str, ) -> &mut Self

Implementors§