Skip to main content

Prop

Enum Prop 

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

Source

pub fn get(&self) -> T

Resolve the current value.

Source

pub fn register_if_bound( &self, widget_id: WidgetId, registry: &BindingRegistry, level: BindingLevel, )

Register dirty tracking for this prop if it is bound.

Source

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<T: Clone + 'static> Clone for Prop<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Clone + Debug + 'static> Debug for Prop<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&String> for Prop<String>

Source§

fn from(s: &String) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Prop<String>

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Prop<Color>> for ColorProp

Source§

fn from(p: Prop<Color>) -> Self

Converts to this type from the input type.
Source§

impl<T: Clone + 'static> From<Signal<T>> for Prop<T>

Source§

fn from(signal: Signal<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Clone + 'static> From<T> for Prop<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl IntoTeksiCondition for Prop<bool>

Source§

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>
where T: Freeze, Signal<T>: Freeze,

§

impl<T> Unpin for Prop<T>
where T: Unpin, Signal<T>: Unpin,

§

impl<T> UnsafeUnpin for Prop<T>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.