Skip to main content

widgetkit_runtime/
lib.rs

1//! Lifecycle-driven runtime for WidgetKit.
2//! The current runtime scope is intentionally a single widget instance per app/host pair.
3//! All timers and background tasks belong to that widget instance and are shut down with it.
4//! Rendering is demand-driven and redraw requests are coalesced until the pending frame is consumed.
5//!
6//! Redraw invalidation model:
7//!
8//! - `request_render()` marks the current frame dirty.
9//! - repeated render requests before the host consumes the pending frame are coalesced.
10//! - hosts should request redraws on demand instead of running a permanent render loop.
11//! - `shutdown` clears pending redraw state before `dispose` completes.
12//! - late messages, timer completions, task completions, and render requests are ignored once
13//!   their widget instance token no longer matches the live instance.
14
15mod app;
16mod context;
17mod event;
18mod host;
19mod internal;
20mod scheduler;
21mod tasks;
22mod widget;
23
24pub use app::{AppRunner, WidgetApp};
25pub use context::{DisposeCtx, MountCtx, RenderCtx, StartCtx, StopCtx, UpdateCtx};
26pub use event::Event;
27pub use host::HostRunner;
28pub use scheduler::Scheduler;
29pub use tasks::Tasks;
30pub use widget::Widget;
31
32pub use widgetkit_core;
33
34// TODO(v0.3): integrate preferred size changes into runtime invalidation model
35// TODO(v0.3): guard against resize-relayout-resize feedback loops
36// TODO(v0.4): route richer host/input events
37// TODO(v0.5): connect sizing contracts to declarative layout
38// TODO(v0.7): allow lifecycle integration with hybrid/native-web host
39// TODO(v0.8): support restart-safe instance isolation guarantees
40// TODO(v0.8): structured concurrency/task groups debug inspection
41// TODO(v0.8): expose task diagnostics/devtools hooks
42// TODO(v0.3): debounce/throttle helpers
43// TODO(v0.8): virtual time/testing scheduler
44
45#[cfg(test)]
46mod tests;