Skip to main content

IntoReactiveValue

Trait IntoReactiveValue 

Source
pub trait IntoReactiveValue {
    // Required method
    fn into_reactive_value(self) -> AttributeValue;
}
Expand description

Trait for types that can be converted into a reactive string value.

This allows both static strings and signals to be used interchangeably in HTML attributes.

Required Methods§

Source

fn into_reactive_value(self) -> AttributeValue

Converts this value into an AttributeValue, wrapping signals for reactive updates or converting static values to text.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoReactiveValue for &str

Converts a string slice into a text attribute value.

Source§

fn into_reactive_value(self) -> AttributeValue

Converts this string slice into an AttributeValue::Text.

§Returns
  • AttributeValue - A text attribute value containing the owned string.
Source§

impl IntoReactiveValue for bool

Converts a bool into a dynamic attribute value.

Stored as AttributeValue::Dynamic("true"/"false") so components can extract the original boolean via try_get_typed_prop.

Source§

fn into_reactive_value(self) -> AttributeValue

Converts this boolean into an AttributeValue::Dynamic.

§Returns
  • AttributeValue - A dynamic attribute value containing the boolean string.
Source§

impl IntoReactiveValue for f64

Converts an f64 into a dynamic attribute value.

Stored as AttributeValue::Dynamic so components can extract the original float via try_get_typed_prop.

Source§

fn into_reactive_value(self) -> AttributeValue

Converts this float into an AttributeValue::Dynamic.

§Returns
  • AttributeValue - A dynamic attribute value containing the float string.
Source§

impl IntoReactiveValue for i32

Converts an i32 into a dynamic attribute value.

Stored as AttributeValue::Dynamic so components can extract the original integer via try_get_typed_prop.

Source§

fn into_reactive_value(self) -> AttributeValue

Converts this integer into an AttributeValue::Dynamic.

§Returns
  • AttributeValue - A dynamic attribute value containing the integer string.
Source§

impl IntoReactiveValue for String

Converts a static String into a text attribute value.

Source§

fn into_reactive_value(self) -> AttributeValue

Converts this string into an AttributeValue::Text.

§Returns
  • AttributeValue - A text attribute value containing this string.

Implementors§

Source§

impl IntoReactiveValue for &'static Css

Converts a reference to a CSS class into an attribute value by cloning.

Source§

impl IntoReactiveValue for Css

Converts a CSS class reference into an attribute value.

Source§

impl IntoReactiveValue for Signal<bool>

Converts a mutable bool signal into a reactive attribute value.

The signal is mapped to a Signal<String> that yields "true" or "false", enabling boolean attributes like checked to reactively update the DOM.

Source§

impl IntoReactiveValue for Signal<String>

Converts a string signal into a reactive attribute value.