zng/update.rs
1//! App update service and other types.
2//!
3//! The [`UPDATES`] service can execute arbitrary futures and setup update handlers. It can also be used to request update,
4//! info rebuild, layout and render for any widget. Note that from inside the widget you should use the [`WIDGET`] service instead,
5//! as it is more efficient.
6//!
7//! The example below setups a handler that is called every app update.
8//!
9//! ```
10//! use zng::prelude::*;
11//! # fn example() {
12//!
13//! zng::update::UPDATES
14//! .on_pre_update(hn!(|args| {
15//! println!("pre_update #{}", args.count);
16//! }))
17//! .perm();
18//! # }
19//! ```
20//!
21//! Updates are coalesced, multiple requests for the same widget will cause it to only update once, and multiple widgets
22//! can update on the same pass. See the [Main Loop] docs in the `app` module for more details.
23//!
24//! [`WIDGET`]: crate::widget::WIDGET
25//! [Main Loop]: crate::app#main-loop
26//!
27//! # Full API
28//!
29//! See [`zng_app::update`] for the full update API.
30
31pub use zng_app::update::{
32 ContextUpdates, EventUpdate, InfoUpdates, LayoutUpdates, OnUpdateHandle, RenderUpdates, UPDATES, UpdateArgs, UpdateDeliveryList,
33 UpdateOp, UpdateSubscribers, UpdatesTraceUiNodeExt, WeakOnUpdateHandle, WidgetUpdates,
34};