Function zng::widget::node::with_context_local_init

source ยท
pub fn with_context_local_init<T>(
    child: impl UiNode,
    context: &'static ContextLocal<T>,
    init_value: impl FnMut() -> T + Send + 'static,
) -> impl UiNode
where T: Any + Send + Sync + 'static,
Expand description

Helper for declaring nodes that sets a context local value generated on init.

The method calls the init_value closure on init to produce a value var that is presented as the ContextLocal<T> in the widget and widget descendants. The closure can be called more than once if the returned node is reinited.

Apart from the value initialization this behaves just like with_context_local.