pub trait UiPlugin: Sized + 'static {
// Required methods
fn activate(cx: &mut Context) -> Self;
fn frame(&mut self, frame: &Frame);
// Provided methods
fn event(&mut self, event: Event, cx: &mut Context) { ... }
fn deactivate(&mut self) { ... }
}Expand description
A UI plugin: one instance runs in every viewer on the account.
It paints its crate::Surfaces and reads account state; it is
side-effect free. Anything that must happen once (a write, a
notification, a request) is either claimed first (claims) or
asked of a companion daemon (calls); crate::view::is_driving
says whether the user is controlling this viewer.
Required Methods§
Sourcefn activate(cx: &mut Context) -> Self
fn activate(cx: &mut Context) -> Self
Called once after instantiation. Create surfaces and read the configuration here.
Sourcefn frame(&mut self, frame: &Frame)
fn frame(&mut self, frame: &Frame)
Called when a paced frame is due and one of the plugin’s surfaces is
visible. Paint, commit, and say when the next frame is wanted
(Frame::request_frame, Frame::wake_at); asking for nothing
waits for an event.
Provided Methods§
Sourcefn event(&mut self, event: Event, cx: &mut Context)
fn event(&mut self, event: Event, cx: &mut Context)
Everything else the host tells the plugin. Surfaces are already
rebound when a Event::Resize arrives.
Sourcefn deactivate(&mut self)
fn deactivate(&mut self)
Called before the instance is dropped.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".