zng::widget::node

Function match_widget

source
pub fn match_widget<W>(
    child: W,
    closure: impl FnMut(&mut MatchWidgetChild<W>, UiNodeOp<'_>) + Send + 'static,
) -> impl UiNode
where W: UiNode,
Expand description

Creates a widget that is implemented as a closure that matches over UiNodeOp and delegates to another child widget.

The returned node will delegate to child like match_node does, and will also delegate UiNode::is_widget and UiNode::with_context.

Note that the closure itself will not run inside UiNode::with_context.

Note that unlike the match_node the W type is always preserved, the feature dyn_node is ignored here.