pub trait App: 'static {
type Spec: Spec;
// Required methods
fn overlay_model(
&self,
win: WindowId,
id: <Self::Spec as Spec>::Overlay,
) -> OverlayModel;
fn panel(&mut self, cx: &mut PanelCx<'_, Self::Spec>);
fn overlay_body(&mut self, cx: &mut OverlayCx<'_, Self::Spec>);
fn intent(
&mut self,
intent: Intent<Self::Spec>,
cx: &mut IntentCx<'_, Self::Spec>,
);
// Provided methods
fn init(&mut self, cx: &mut InitCx<'_, Self::Spec>) { ... }
fn chrome_model(&self, win: WindowId) -> ChromeModel { ... }
fn shutdown(&mut self) { ... }
}Expand description
The application: view-model declarations, content hooks and the intent sink. One value drives any number of windows.
All hooks run on the runtime’s thread inside the tick (intent,
shutdown) or the compose phase (chrome_model, overlay_model,
panel, overlay_body). Business state stays behind the app’s own
back-office handle; nothing back-office crosses into this crate
(design §6.5).
Required Associated Types§
Required Methods§
Sourcefn overlay_model(
&self,
win: WindowId,
id: <Self::Spec as Spec>::Overlay,
) -> OverlayModel
fn overlay_model( &self, win: WindowId, id: <Self::Spec as Spec>::Overlay, ) -> OverlayModel
What the kernel draws around one open overlay’s body, declared per
frame. The body itself is drawn by App::overlay_body.
Sourcefn panel(&mut self, cx: &mut PanelCx<'_, Self::Spec>)
fn panel(&mut self, cx: &mut PanelCx<'_, Self::Spec>)
Draw one visible dock leaf’s content with library widget functions, once per frame per leaf. The kernel gives the content rect (inside the leaf’s frame and tab strip) and a scoped registration layer.
Sourcefn overlay_body(&mut self, cx: &mut OverlayCx<'_, Self::Spec>)
fn overlay_body(&mut self, cx: &mut OverlayCx<'_, Self::Spec>)
Draw one open overlay’s body into the rect the frame leaves, once per frame per open overlay.
Provided Methods§
Sourcefn init(&mut self, cx: &mut InitCx<'_, Self::Spec>)
fn init(&mut self, cx: &mut InitCx<'_, Self::Spec>)
Startup: enqueue the initial windows, keymap bindings and default layout as commands. Runs once before the first tick.
Sourcefn chrome_model(&self, win: WindowId) -> ChromeModel
fn chrome_model(&self, win: WindowId) -> ChromeModel
What the kernel draws as this window’s chrome strip, declared per
frame. Compose diffs it against the layout engine’s model and
applies a SetChromeModel on change (the engine stays the single
writer; hit-testing reads the same model the kernel draws).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".