zng_wgt::node

Function with_widget_state_modify

source
pub fn with_widget_state_modify<U, S, V, I, M>(
    child: U,
    id: impl Into<StateId<S>>,
    value: impl IntoVar<V>,
    default: I,
    modify: M,
) -> impl UiNode
where U: UiNode, S: StateValue, V: VarValue, I: Fn() -> S + Send + 'static, M: FnMut(&mut S, &V) + Send + 'static,
Expand description

Helper for declaring properties that set the widget state with a custom closure.

The default closure is used to init the state value, then the modify closure is used to modify the state using the variable value.

On deinit the default value is set on the state again.

See with_widget_state for more details.