Skip to main content

euv_core/reactive/
trait.rs

1use crate::*;
2
3/// Trait for types that can be converted into a reactive string value.
4///
5/// This allows both static strings and signals to be used interchangeably
6/// in HTML attributes.
7pub trait IntoReactiveValue {
8    /// Converts this value into an `AttributeValue`, wrapping signals
9    /// for reactive updates or converting static values to text.
10    fn into_reactive_value(self) -> AttributeValue;
11}
12
13/// Trait for types that can be converted into a callback attribute value.
14///
15/// This allows closures to be passed as custom component props.
16pub trait IntoCallbackAttribute {
17    /// Converts this value into an `AttributeValue`, wrapping the callback
18    /// for use as a component prop.
19    fn into_callback_attribute(self) -> AttributeValue;
20}