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 list node implementers to toggle parallel processing.
8///
9/// Note that this property is set at the `WIDGET` nest group, so it will affect all parallelization in the widget, even in
10/// list at the root of the widget.
11///
12/// See also `WINDOWS.parallel` to define parallelization between multiple windows.
13///
14/// [`PARALLEL_VAR`]: zng_app::widget::base::PARALLEL_VAR
15#[property(WIDGET, default(PARALLEL_VAR))]
16pub fn parallel(child: impl IntoUiNode, enabled: impl IntoVar<Parallel>) -> UiNode {
17 with_context_var(child, PARALLEL_VAR, enabled)
18}