pub trait LuaHost {
// Required method
fn run(
&self,
engine: &mut Engine,
name: &str,
code: &[u8],
) -> Result<(), String>;
// Provided methods
fn dump(&self, _engine: &mut Engine) -> Vec<u8> ⓘ { ... }
fn undump(&self, _engine: &mut Engine, _data: &[u8]) -> Result<(), String> { ... }
fn call_simple(
&self,
_engine: &mut Engine,
_name: &str,
) -> Result<(), String> { ... }
fn has_callback(&self, _name: &str) -> bool { ... }
fn define_font(
&self,
_engine: &mut Engine,
_name: &[u8],
_size: i32,
) -> Option<u32> { ... }
fn list_filter(
&self,
_engine: &mut Engine,
_callback: &str,
head: NodeRef,
_group: &str,
) -> ListFilter { ... }
fn glyph_info(&self, _engine: &mut Engine, _p: NodeRef) -> Option<Vec<u8>> { ... }
}Expand description
Callbacks from the engine into an embedded Lua interpreter.
The engine does not depend on Lua. \directlua and related primitives
call this trait, which retex-lua implements. The host is shared
(Rc), so nested calls (Lua → TeX → Lua) reach it too.
Required Methods§
Provided Methods§
Sourcefn dump(&self, _engine: &mut Engine) -> Vec<u8> ⓘ
fn dump(&self, _engine: &mut Engine) -> Vec<u8> ⓘ
Data to store in the format file (e.g. lua.bytecode).
Sourcefn undump(&self, _engine: &mut Engine, _data: &[u8]) -> Result<(), String>
fn undump(&self, _engine: &mut Engine, _data: &[u8]) -> Result<(), String>
Restores data stored by dump.
Sourcefn call_simple(&self, _engine: &mut Engine, _name: &str) -> Result<(), String>
fn call_simple(&self, _engine: &mut Engine, _name: &str) -> Result<(), String>
Calls callback name without arguments, ignoring its results
(pre_dump, stop_run, …). Does nothing if none is registered.
Sourcefn has_callback(&self, _name: &str) -> bool
fn has_callback(&self, _name: &str) -> bool
Whether a Lua function is registered for callback name.
Sourcefn define_font(
&self,
_engine: &mut Engine,
_name: &[u8],
_size: i32,
) -> Option<u32>
fn define_font( &self, _engine: &mut Engine, _name: &[u8], _size: i32, ) -> Option<u32>
Calls the define_font callback. Returns the id of the font it
defined, or None if the font could not be loaded.
Sourcefn list_filter(
&self,
_engine: &mut Engine,
_callback: &str,
head: NodeRef,
_group: &str,
) -> ListFilter
fn list_filter( &self, _engine: &mut Engine, _callback: &str, head: NodeRef, _group: &str, ) -> ListFilter
Calls a node-list filter callback (pre_linebreak_filter,
hpack_filter, post_linebreak_filter, …) on the list starting at
head. Returns the new head; ListFilter::Flush means the list
must be discarded.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".