Trait Plugin

Source
pub trait Plugin:
    Send
    + Sync
    + Any
    + 'static {
    // Required method
    fn debug_name(&self) -> &'static str;

    // Provided methods
    fn setup(&mut self, ctx: &Context) { ... }
    fn on_begin_pass(&mut self, ctx: &Context) { ... }
    fn on_end_pass(&mut self, ctx: &Context) { ... }
    fn input_hook(&mut self, input: &mut RawInput) { ... }
    fn output_hook(&mut self, output: &mut FullOutput) { ... }
}
Expand description

A plugin to extend egui.

Add plugins via Context::add_plugin.

Plugins should not hold a reference to the Context, since this would create a cycle (which would prevent the Context from being dropped).

Required Methods§

Source

fn debug_name(&self) -> &'static str

Plugin name.

Used when profiling.

Provided Methods§

Source

fn setup(&mut self, ctx: &Context)

Called once, when the plugin is registered.

Useful to e.g. register image loaders.

Source

fn on_begin_pass(&mut self, ctx: &Context)

Called at the start of each pass.

Can be used to show ui, e.g. a crate::Window or crate::SidePanel.

Source

fn on_end_pass(&mut self, ctx: &Context)

Called at the end of each pass.

Can be used to show ui, e.g. a crate::Window.

Source

fn input_hook(&mut self, input: &mut RawInput)

Called just before the input is processed.

Useful to inspect or modify the input. Since this is called outside a pass, don’t show ui here.

Source

fn output_hook(&mut self, output: &mut FullOutput)

Called just before the output is passed to the backend.

Useful to inspect or modify the output. Since this is called outside a pass, don’t show ui here.

Implementors§