zng_wgt/parallel_prop.rs
1use zng_app::widget::base::{PARALLEL_VAR, Parallel};
2
3use crate::prelude::*;
4
5/// Defines what node list methods can run in parallel in the widget and descendants.
6///
7/// This property sets the [`PARALLEL_VAR`] that is used by [`UiNodeList`] implementers to toggle parallel processing.
8///
9/// See also `WINDOWS.parallel` to define parallelization in multi-window apps.
10///
11/// [`UiNode`]: zng_app::widget::node::UiNodeList
12/// [`PARALLEL_VAR`]: zng_app::widget::base::PARALLEL_VAR
13/// [`UiNodeList`]: zng_app::widget::node::UiNodeList
14#[property(CONTEXT, default(PARALLEL_VAR))]
15pub fn parallel(child: impl UiNode, enabled: impl IntoVar<Parallel>) -> impl UiNode {
16 with_context_var(child, PARALLEL_VAR, enabled)
17}