Function zng::widget::node::bind_state_init

source ยท
pub fn bind_state_init<T, V>(
    child: impl UiNode,
    source: impl Fn() -> V + Send + 'static,
    state: impl IntoVar<T>,
) -> impl UiNode
where T: VarValue, V: Var<T>,
Expand description

Helper for declaring state properties that are controlled by a variable.

On init the state closure is called to provide a variable, the variable is set to source and bound to it, you can use this to create state properties that map from a context variable or to create composite properties that merge other state properties.