Skip to main content

Host

Trait Host 

Source
pub trait Host {
    // Required methods
    fn typeset(&self, latex: &str) -> Fragment;
    fn on_change(&self, doc: &Document);
    fn on_exit(&self, dir: ExitDir);
    fn request_close(&self);
    fn on_render(&self);

    // Provided method
    fn on_object_enter(&self, token: u32, side: Side) -> bool { ... }
}
Expand description

Callbacks implemented by the host.

Required Methods§

Source

fn typeset(&self, latex: &str) -> Fragment

Typeset a LaTeX fragment to the mathtex IR.

Source

fn on_change(&self, doc: &Document)

Handle changed content.

Source

fn on_exit(&self, dir: ExitDir)

Handle the caret leaving the math region at a boundary.

Source

fn request_close(&self)

Request that math mode ends.

Source

fn on_render(&self)

Request a repaint via Editor::render.

Provided Methods§

Source

fn on_object_enter(&self, token: u32, side: Side) -> bool

Handle horizontal caret motion into a host object, true consumes the motion.

side is the direction of approach, Before when moving right and After when moving left. The default leaves the motion unconsumed, so the caret skips over the object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§