pub enum Prop<T: Clone + 'static> {
Static(T),
Bound(Signal<T>),
}Expand description
A property value that is either static or bound to a reactive signal.
Widget property methods accept impl Into<Prop<T>> for flexibility.
Variants§
Static(T)
A fixed value, set once.
Bound(Signal<T>)
Bound to a signal; value read lazily on each use.
Implementations§
Source§impl<T: Clone + 'static> Prop<T>
impl<T: Clone + 'static> Prop<T>
Sourcepub fn register_if_bound(
&self,
widget_id: WidgetId,
registry: &BindingRegistry,
level: BindingLevel,
)
pub fn register_if_bound( &self, widget_id: WidgetId, registry: &BindingRegistry, level: BindingLevel, )
Register dirty tracking for this prop if it is bound.
Sourcepub fn as_signal(&self) -> Signal<T>
pub fn as_signal(&self) -> Signal<T>
Return the underlying signal if bound, or wrap a static value in a
fresh, unshared signal. Use when an existing code path needs a
Signal<T> (e.g. ctx.effect(&signal, ...)) but the widget field
was widened from Signal<T> to Prop<T> — the derived signal
preserves reactivity for the Bound case with minimal churn.
Trait Implementations§
Source§impl IntoTeksiCondition for Prop<bool>
impl IntoTeksiCondition for Prop<bool>
fn teksilo_into_conditional_child<W: Widget + 'static>( self, child: W, ctx: &mut BuildContext<'_>, ) -> Option<WidgetId>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Prop<T>
impl<T> !Send for Prop<T>
impl<T> !Sync for Prop<T>
impl<T> !UnwindSafe for Prop<T>
impl<T> Freeze for Prop<T>
impl<T> Unpin for Prop<T>
impl<T> UnsafeUnpin for Prop<T>
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
Mutably borrows from an owned value. Read more