pub struct ComponentWidget<C: Component> { /* private fields */ }Expand description
The retained widget behind a ComponentView.
The child element is double-boxed inside the pod (ChildPod::new(Box::new(element)))
so a rebuild can recover the &mut Box<dyn Widget> that AnyView::rebuild
needs to swap the widget on a concrete-type change.
Under hotpatch the struct is repr(C), starts with the [SeamWitness] of
the creating image and boxes the state, so field offsets are image-independent.
rebuild, teardown and Drop check the witness first; on a mismatch Drop
leaks the state box rather than let another image’s layout free it, and still
disposes the owner.
Trait Implementations§
Source§impl<C: Component> Drop for ComponentWidget<C>
impl<C: Component> Drop for ComponentWidget<C>
Source§impl<C: Component> SliverWidget for ComponentWidget<C>
impl<C: Component> SliverWidget for ComponentWidget<C>
Source§fn layout_sliver(
&mut self,
ctx: &mut LayoutCtx<'_>,
sc: &SliverConstraints,
) -> SliverGeometry
fn layout_sliver( &mut self, ctx: &mut LayoutCtx<'_>, sc: &SliverConstraints, ) -> SliverGeometry
Pass-through, like Widget::layout: sc reaches the child unchanged.
Source§impl<C: Component> Widget for ComponentWidget<C>
impl<C: Component> Widget for ComponentWidget<C>
Source§fn as_sliver(&mut self) -> Option<&mut dyn SliverWidget>
fn as_sliver(&mut self) -> Option<&mut dyn SliverWidget>
A component is a sliver exactly when its child is. The sliver face is the component itself, so layout runs through the child pod and leaves it sized for this component’s paint, hit test and semantics.
Source§fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size
fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size
bc and return it. Under a render root the call
may be skipped (see ChildPod::layout_child), so the result must
depend only on bc, the context’s globals and state changed through a
pod-dirtying channel: a LAYOUT rebuild, request_layout, an unpaced
frame request, or a handled / redraw-requesting event.Source§fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)
fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)
scene. Paint may advance animation state; it
must then call PaintCtx::request_frame until the animation rests.Source§fn semantics(&self, ctx: &mut SemanticsCtx)
fn semantics(&self, ctx: &mut SemanticsCtx)
ChildPod::semantics_child.Source§fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))
fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))
ChildPods in paint order, for read-only
tooling; defaults to none and must not mutate pass state.Source§fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult
fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult
EventResult::Ignored. Containers forward via ChildPod::event_child.Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
docs/LIMITATIONS.md
focus-wrapper-erasure-swap-blind); override only in a transparent wrapper.Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Source§fn visit_focus_children(&self, visitor: &mut dyn FnMut(&ChildPod))
fn visit_focus_children(&self, visitor: &mut dyn FnMut(&ChildPod))
Widget::visit_children. A container showing only some children narrows it.