Skip to main content

LuaTexHost

Struct LuaTexHost 

Source
pub struct LuaTexHost { /* private fields */ }
Expand description

The Lua interpreter with LuaTeX’s libraries.

Implementations§

Source§

impl LuaTexHost

Source

pub fn new() -> Result<Rc<Self>>

Creates the interpreter and installs the libraries.

Source

pub fn lua(&self) -> &Lua

The underlying Lua state.

Source

pub fn attach(engine: &mut Engine) -> Result<Rc<Self>>

Installs a host into an engine.

Trait Implementations§

Source§

impl Drop for LuaTexHost

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl LuaHost for LuaTexHost

Source§

fn run( &self, engine: &mut Engine, name: &str, code: &[u8], ) -> Result<(), String>

Runs a chunk of Lua code for \directlua (or \latelua, etc.). name is the chunk name. Text printed with tex.print must be pushed back into the engine’s input by the host.
Source§

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.
Source§

fn has_callback(&self, name: &str) -> bool

Whether a Lua function is registered for callback name.
Source§

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.
Source§

fn list_filter( &self, engine: &mut Engine, callback_name: &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.
Source§

fn glyph_info(&self, engine: &mut Engine, p: NodeRef) -> Option<Vec<u8>>

Calls the glyph_info callback for glyph node p: Some(text) is what to print, None means the callback returned no string.
Source§

fn dump(&self, _engine: &mut Engine) -> Vec<u8> ⓘ

Data to store in the format file (e.g. lua.bytecode).
Source§

fn undump(&self, _engine: &mut Engine, data: &[u8]) -> Result<(), String>

Restores data stored by dump.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.