pub struct AttrValueAdapter<T> { /* private fields */ }Expand description
Adapts an arbitrary attribute value expression into an AttributeValue.
Handles the dispatch between event closures and reactive values without
requiring the macro to generate inline trait hierarchies. The macro emits
AttrValueAdapter::new(expr).into_attribute_value() instead of the
__IsClosure / __ClosurePicker / __ValuePicker / __FallbackHelper
/ __dispatch boilerplate.
For event attributes (key starts with “on”), event closures are wrapped
into AttributeValue::Event. For non-event attributes, values are
converted via IntoReactiveValue.
Implementations§
Source§impl<T> AttrValueAdapter<T>
impl<T> AttrValueAdapter<T>
pub fn get_mut_inner(&mut self) -> &mut T
Source§impl<T> AttrValueAdapter<T>
impl<T> AttrValueAdapter<T>
Source§impl<F> AttrValueAdapter<F>
Adapts a FnMut(Event) closure into a callback AttributeValue.
impl<F> AttrValueAdapter<F>
Adapts a FnMut(Event) closure into a callback AttributeValue.
This handles the case where a closure is used as a component callback prop.
The closure is converted via IntoCallbackAttribute::into_callback_attribute().
Sourcepub fn into_callback_attribute_value(self) -> AttributeValue
pub fn into_callback_attribute_value(self) -> AttributeValue
Converts the wrapped closure into a callback AttributeValue.
§Returns
AttributeValue- An event attribute value wrapping the adapted closure.
Sourcepub fn into_callback_attribute_value_with_name(
self,
name: &'static str,
) -> AttributeValue
pub fn into_callback_attribute_value_with_name( self, name: &'static str, ) -> AttributeValue
Source§impl AttrValueAdapter<NativeEventHandler>
Adapts an owned NativeEventHandler into an AttributeValue::Event directly.
impl AttrValueAdapter<NativeEventHandler>
Adapts an owned NativeEventHandler into an AttributeValue::Event directly.
Sourcepub fn into_callback_attribute_value(self) -> AttributeValue
pub fn into_callback_attribute_value(self) -> AttributeValue
Converts the wrapped handler into an event AttributeValue.
§Returns
AttributeValue- AnAttributeValue::Eventcontaining the re-wrapped handler.
Sourcepub fn into_callback_attribute_value_with_name(
self,
name: &'static str,
) -> AttributeValue
pub fn into_callback_attribute_value_with_name( self, name: &'static str, ) -> AttributeValue
Source§impl AttrValueAdapter<Option<NativeEventHandler>>
Adapts an Option<NativeEventHandler> into an AttributeValue.
impl AttrValueAdapter<Option<NativeEventHandler>>
Adapts an Option<NativeEventHandler> into an AttributeValue.
Sourcepub fn into_callback_attribute_value(self) -> AttributeValue
pub fn into_callback_attribute_value(self) -> AttributeValue
Converts the wrapped optional handler into an attribute value.
§Returns
AttributeValue- An event attribute ifSome, otherwise an empty text attribute.
Sourcepub fn into_callback_attribute_value_with_name(
self,
name: &'static str,
) -> AttributeValue
pub fn into_callback_attribute_value_with_name( self, name: &'static str, ) -> AttributeValue
Source§impl<T> AttrValueAdapter<T>where
T: IntoReactiveValue,
Adapts any IntoReactiveValue type into an AttributeValue.
impl<T> AttrValueAdapter<T>where
T: IntoReactiveValue,
Adapts any IntoReactiveValue type into an AttributeValue.
This is the fallback path for non-closure attribute values (strings, signals,
CSS classes, etc.). The value is converted via IntoReactiveValue::into_reactive_value().
Sourcepub fn into_reactive_attribute_value(self) -> AttributeValue
pub fn into_reactive_attribute_value(self) -> AttributeValue
Converts the wrapped value into an AttributeValue via reactive value adaptation.
§Returns
AttributeValue- The reactive attribute value.