Skip to main content

AppEventPoster

Trait AppEventPoster 

Source
pub trait AppEventPoster:
    Send
    + Sync
    + 'static {
    // Required method
    fn post_subscription_event(
        &self,
        sub_id: SubscriptionId,
        event: Box<dyn Any + Send>,
    );

    // Provided method
    fn post_external(&self, _payload: Box<dyn Any + Send>) { ... }
}
Expand description

Posts events from background threads back to the UI thread.

teksilo-core cannot depend on winit or teksilo-app, so this trait acts as the boundary: teksilo-app provides an implementation that wraps the EventLoopProxy<AppEvent> and converts the calls into the matching AppEvent::* user-event variants.

Two posting paths share this trait:

  • post_subscription_event — backend events for widgets that subscribed via BuildContext::subscribe_event.
  • post_external — arbitrary typed payloads delivered as AppEvent::External. Used by async OS-driven integrations (file dialogs, future background tasks) that resolve off the UI thread and need to deliver typed results back to the main loop.

Required Methods§

Source

fn post_subscription_event( &self, sub_id: SubscriptionId, event: Box<dyn Any + Send>, )

Provided Methods§

Source

fn post_external(&self, _payload: Box<dyn Any + Send>)

Post an arbitrary typed payload as AppEvent::External(_). Default body is a no-op so existing implementations stay source-compatible; the real implementation in teksilo-app forwards to EventLoopProxy::send_event.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§