pub struct WidgetPod { /* private fields */ }Expand description
Standard retained-widget adapter used by the SUI runtime.
WidgetPod gives a Widget stable identity, cached layout state, event
routing participation, and scene/semantics cooperation. It is the default
local retained model, but a widget’s own internals may still use custom
state, virtualization, worker threads, or remote systems before rejoining
SUI through widget contexts and scene output.
Implementations§
Source§impl WidgetPod
impl WidgetPod
pub fn new<W>(widget: W) -> WidgetPodwhere
W: Widget + 'static,
Sourcepub fn new_boxed(widget: Box<dyn Widget>) -> WidgetPod
pub fn new_boxed(widget: Box<dyn Widget>) -> WidgetPod
Retain a type-erased widget without inserting an additional adapter into the logical widget tree.
Dynamic widget registries use this when the concrete widget type is selected from application data at runtime.
pub const fn id(&self) -> WidgetId
pub fn debug_name(&self) -> &'static str
pub fn diagnostics_snapshot(&self) -> WidgetDiagnosticsSnapshot
pub fn collect_diagnostics(&self, output: &mut Vec<WidgetDiagnosticsSnapshot>)
pub const fn bounds(&self) -> Rect
pub const fn measured_size(&self) -> Size
pub const fn presentation_transform(&self) -> Transform
pub fn set_bounds(&mut self, bounds: Rect)
Sourcepub fn probe_measure(
&mut self,
parent_ctx: &mut MeasureCtx,
constraints: Constraints,
) -> Size
pub fn probe_measure( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, ) -> Size
Query a size without requiring the widget’s retained layout to match it.
Keep four recent results locally, backed by the window’s bounded query
cache. Widget revisions and layout contexts invalidate both tiers.
Call measure with the final constraints before arrangement: a probe hit
does not restore child layouts, text handles, or other committed state.
Final measure calls in dirty/forced subtrees still always execute.
Sourcepub fn probe_measure_axis(
&mut self,
parent_ctx: &mut MeasureCtx,
constraints: Constraints,
axis: Axis,
) -> f32
pub fn probe_measure_axis( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, axis: Axis, ) -> f32
Size-only query for one axis; shares the exact-key, invalidation and
bounded eviction rules of probe_measure, with a distinct query kind.
pub fn measure( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, ) -> Size
pub fn intrinsic_size( &mut self, parent_ctx: &mut MeasureCtx, axis: Axis, available_cross: f32, ) -> IntrinsicSize
pub fn arrange(&mut self, parent_ctx: &mut ArrangeCtx, bounds: Rect)
Sourcepub fn arrange_transformed(
&mut self,
parent_ctx: &mut ArrangeCtx,
bounds: Rect,
transform: Transform,
)
pub fn arrange_transformed( &mut self, parent_ctx: &mut ArrangeCtx, bounds: Rect, transform: Transform, )
Arrange this widget in parent coordinates and apply an affine transform to its complete retained subtree for paint, input, and semantics.
pub fn paint(&self, parent_ctx: &mut PaintCtx)
pub fn semantics(&self, parent_ctx: &mut SemanticsCtx)
Sourcepub fn accepts_focus(&self) -> bool
pub fn accepts_focus(&self) -> bool
Return whether this retained widget is a focus target.
Adaptive containers use this while selecting a restoration fallback for a subtree that has just become visible again.
Sourcepub fn visit_children(&self, visitor: &mut dyn WidgetPodVisitor)
pub fn visit_children(&self, visitor: &mut dyn WidgetPodVisitor)
Visit this pod’s direct children. Public so container widgets can walk their own subtree (e.g. to derive a focus-within visual by comparing descendant ids against the focused widget id — sui has no focus-within event, and any focus change repaints every window, so polling at paint time stays correct).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WidgetPod
impl !RefUnwindSafe for WidgetPod
impl !Send for WidgetPod
impl !Sync for WidgetPod
impl !UnwindSafe for WidgetPod
impl Unpin for WidgetPod
impl UnsafeUnpin for WidgetPod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.