Trait embedded_text::plugin::Plugin[][src]

pub trait Plugin<'a, C>: Clone where
    C: PixelColor, 
{ fn new_line(&mut self) { ... }
fn next_token(
        &mut self,
        next_token: impl FnMut() -> Option<Token<'a, C>>
    ) -> Option<Token<'a, C>> { ... }
fn render_token(&mut self, token: Token<'a, C>) -> Option<Token<'a, C>> { ... }
fn post_render<T, D>(
        &mut self,
        _draw_target: &mut D,
        _character_style: &T,
        _text: &str,
        _bounds: Rectangle
    ) -> Result<(), D::Error>
    where
        T: TextRenderer<Color = C>,
        D: DrawTarget<Color = C>
, { ... }
fn on_start_render<S: TextRenderer>(
        &mut self,
        _text_box: &TextBox<'a, S, Self>,
        _cursor: &mut Cursor
    ) { ... } }
Expand description

Plugin trait.

Plugins allow modifying and extending TextBox’s internals.

Important: This is an experimental, unstable feature. It can be, and probably will be modified without any prior notice. Using plugins require enabling the plugin crate feature.

Provided methods

Called when a new line is started.

Generate the next text token.

Modify the current token immediately before it is rendered.

This function must return the same token type as the input, otherwise the returned token is ignored.

Called after a piece of text is rendered.

Called before TextBox rendering is started.

Implementors