Struct rscript::scripting::DynamicScript[][src]

#[repr(C)]
pub struct DynamicScript { pub script_info: extern "C" fn() -> FFiData, pub script: extern "C" fn(_: FFiStr, _: FFiData) -> FFiData, }
Expand description

A ScriptType::DynamicLib script needs to export a static instance of this struct named DynamicScript::NAME

// In a script file
#[no_mangle]
pub static SCRIPT: DynamicScript = DynamicScript { script_info: .., script: .. };

DynamicScript contains also methods for writing scripts: DynamicScript::read, DynamicScript::write

Fields

script_info: extern "C" fn() -> FFiData

A function that returns ScriptInfo serialized as FFiData
fn() -> ScriptInfo

script: extern "C" fn(_: FFiStr, _: FFiData) -> FFiData

A function that accepts a hook name (casted to FFiStr) and the hook itself (serialized as FFiData) and returns the hook output (serialized as FFiData)
fn<H: Hook>(hook: &str (H::Name), data: H) -> ::Output>

Implementations

pub const NAME: &'static [u8] = b"SCRIPT";

Read a hook from an FFiData

Write a value to an FFiData It takes the hook as a type argument in-order to make sure that the output provided correspond to the hook’s expected output

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.