Skip to main content

LanguageLoader

Trait LanguageLoader 

Source
pub trait LanguageLoader: Send + Sync {
    // Required methods
    fn load(&mut self, name: &str, code: Vec<String>) -> Result<bool, String>;
    fn call(&self, name: &str, args: Vec<String>) -> Result<String, String>;
}
Expand description

The trait for a custom programming language loader for RiveScript object macros.

The load() function will receive the name of the object macro along with its source code (as lines of text). Your LanguageLoader might then parse and evaluate the code using your backing runtime or VM.

The call() function is invoked when a named object macro has been called via the <call> tag in a RiveScript reply. The name is the name of the object macro and the args are the parameters (using shell-style quoting rules, so a “quoted string” would come as one item of the Vec<String>).

Required Methods§

Source

fn load(&mut self, name: &str, code: Vec<String>) -> Result<bool, String>

Source

fn call(&self, name: &str, args: Vec<String>) -> Result<String, String>

Implementors§