Skip to main content

WidgetPod

Struct WidgetPod 

Source
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

Source

pub fn new<W>(widget: W) -> WidgetPod
where W: Widget + 'static,

Source

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.

Source

pub const fn id(&self) -> WidgetId

Source

pub fn debug_name(&self) -> &'static str

Source

pub fn diagnostics_snapshot(&self) -> WidgetDiagnosticsSnapshot

Source

pub fn collect_diagnostics(&self, output: &mut Vec<WidgetDiagnosticsSnapshot>)

Source

pub const fn bounds(&self) -> Rect

Source

pub const fn measured_size(&self) -> Size

Source

pub const fn presentation_transform(&self) -> Transform

Source

pub fn set_bounds(&mut self, bounds: Rect)

Source

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.

Source

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.

Source

pub fn measure( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, ) -> Size

Source

pub fn intrinsic_size( &mut self, parent_ctx: &mut MeasureCtx, axis: Axis, available_cross: f32, ) -> IntrinsicSize

Source

pub fn arrange(&mut self, parent_ctx: &mut ArrangeCtx, bounds: Rect)

Source

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.

Source

pub fn paint(&self, parent_ctx: &mut PaintCtx)

Source

pub fn semantics(&self, parent_ctx: &mut SemanticsCtx)

Source

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.

Source

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§

Source§

impl Drop for WidgetPod

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more